PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Wednesday, March 9, 2022

[FIXED] How to get field names of mysql table in codeigniter?

 March 09, 2022     codeigniter, mysql, php, sql     No comments   

Issue

i am new in codeigniter. And i am trying to get field name of a table with a query.

I have write a query

"select * from user"

and pass it to $this->db->query() function. i am getting records. But i want to get field names of table. so how can i get that?

Can anybody help me please. Thanks in advance.


Solution

using database library write this code to list all fields:

$this->db->list_fields('table')

take a look here: https://codeigniter.com/userguide3/database/results.html#CI_DB_result::list_fields



Answered By - semsem
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing