I have a form field, with around 40 checkboxes. When users ticks checkboxes, depending upon the checked checkbox, the fields from database is selected. So, they can check all or any of them to show what fields in the report. I have made successful sql query and it executes well. All i m having problem is looping through the record set and populating the html table because I m unknown what columns they selected to show. I m trying to sorting out the issue, but nothing is coming in my head right now. Any help will be highly appreciated. I just need an idea! I m using the query method of the codeigniter-
$query=$this->db->query($sql);
Thanks
If you’re looping through the dataset like they do in the documentation here, why don’t you just get the result_array() then retrieve the array_keys while you’re looping through each row?