CodeIgniter列表字段

CodeIgniter列表字段

本文介绍了CodeIgniter列表字段的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用CodeIgniter 2.1.3.我的功能list_fields()有问题它应该返回MySQL结果的字段数组.因此,下面的代码应列出MySQL结果的所有字段.

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;
}

在Windows上可以正常运行,但在Linux上则无法运行,但是如果结果中的行数为零,则即使在Linux中也可以使用.

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.

知道发生了什么事吗?

推荐答案

尝试检查linux计算机上的mysql是否有错误(通常位于/var/log/mysql/error.log中).

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

确保Linux机器中的PHP和MySQL版本与Windows机器相同. 在特定版本中存在错误.

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.

这篇关于CodeIgniter列表字段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-23 00:04