【发布时间】:2021-12-26 21:08:50
【问题描述】:
这对我来说很奇怪。因为在 codeigniter 4 中,我的一个功能是在控制器中工作,但不在视图中工作。我从控制器中的数据库中获取数据,但是当我尝试从视图中获取相同的数据时,它显示mysqli_sql_exception #1064。
示例代码:
在控制器(MyData.php)
function get_data($status){
return $this->Data->get_data($status);
}
function view_data(){
return view('user/view-data',['data'=>$this])
}
在模型(MyData.php)
function get_data($status="approved"){
return $this->select()->where('status',$status)->get()->getResultArray();
}
在查看(MyData.php)
$datas = $data->get_data('approved');
错误
mysqli_sql_exception #1064
You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '*, *, *
【问题讨论】:
标签: codeigniter mysql-error-1064 codeigniter-4