【发布时间】:2019-04-03 11:15:40
【问题描述】:
我已运行此code 以显示database 表中的所有columns。
public function autorun()
{
$mysql_query = "show columns from store_accounts";
$query = $this->db->simple_query($mysql_query);
foreach ($query->result() as $row) {
$column_name = $row->Field;
echo $column_name; exit;
}
}
但它给了我这个错误。
调用未定义的方法 mysqli_result::result()
【问题讨论】:
-
simple_query 不会返回任何结果,它只会检查并返回 TRUE & FALSE\
-
你需要使用 $this->db->query('YOUR QUERY HERE');得到结果
-
@M.Hemant $query = $this->db->query("显示来自 store_accounts 的列"); $mysql_query = $query->result();然后我在 foreach 中写 $mysql_query 但它显示一列
标签: php codeigniter