CodeIgniter list-fields

2019-02-14 02:40发布

问题:

I'm using CodeIgniter 2.1.3. I have problem with function list_fields() which should return an array of fields of the MySQL result. So my code below should list all fields of the MySQL result.

$query = $this->db->query("SELECT * from $tablename where REGNO='$keyword' " );
$fields  = $query->list_fields();
foreach ($fields as $f)
{
echo $f;
} 

It works fine in Windows but it is not working in Linux, but if the number of rows are zero in results, it works even in Linux.

Any idea what's going wrong?

回答1:

Try to check if there are any errors of your mysql on your linux machine (usually located in /var/log/mysql/error.log).

Make sure that the PHP and MySQL version in your Linux machine is the same as your Windows machine in case there are bugs on them in particular version.