Codeigniter $query->list_fields() returning nothing on LINUX with same php code Codeigniter $query->list_fields() returning nothing on LINUX with same php code codeigniter codeigniter

Codeigniter $query->list_fields() returning nothing on LINUX with same php code


I've seen some (intermittent/strange) problems with CentOS 6.4 with MySQL versions higher than the one installed by default (5.1.69) due to the fact that the PHP MySQL Client API library has not been updated (check with phpinfo that is version 5.1.69). You should update it if it's the case.


You could double-check the case of the filenames. Windows ignores it and therefore can find files that you've named differently to the recommended system. Moving it to Linux would cause the filenames to be case sensitive and the system might not find the relevant libraries/models/etc.


This shouldn't be very hard to debug at least to the point of finding the exact point of failure.

First, your paragraph description is complete, but very hard to follow precisely which of your logging points are being captured. At little editing would be helpful.

1) Call ->num_rows(), not the variable directly, is a better idea

2) Confirm for us that get_collumns_as_array() is being called, as that's where your code issue is.

3) Not a good idea to use $query->functions() in the foreach loop: bad performance, and you can't easily test what's happening. Dump it in a variable and var_dump() it so we can confirm that list_fields() isn't returning anything, and it isn't just hiding some other issue (ie, $list_fields = $query->list_fields() )

4) I'm confused why you are using result_object() - this is normally used for passing in a class object; I think you only want result_array(), but perhaps you are doing something I don't see. It also seems like you are setting $rows = true/false, but again maybe there's more here. Seems like you are using too much "clever" code

5) If you confirm that things run correctly up until $list_fields = $query->list_fields(), this means your issue is in the list_fields() function. This function just uses mysql_fetch_field() to pull the fields from the query result. So, set up a simple php test on your server to confirm that function is working correctly

At this point, you should at least have narrowed things down much more precisely, and you can come back with a more specific question people can try to help you unravel.