Suggest a feature
×

Welcome to TagMyCode

Please login or create account to add a snippet.
0
0
 
0
Language: PHP
Posted by: Dylan Lopez
Added: Apr 3, 2018 2:38 AM
Views: 11
Returns an array containing the field names. This query can be called two ways:
  1. $fields = $this->db->list_fields('table_name');
  2.  
  3. foreach ($fields as $field)
  4. {
  5.         echo $field;
  6. }
  7.  
  8. //OR
  9. $query = $this->db->query('SELECT * FROM some_table');
  10.  
  11. foreach ($query->list_fields() as $field)
  12. {
  13.         echo $field;
  14. }