【发布时间】:2018-08-26 17:03:38
【问题描述】:
我的控制器代码
public function all_ratings(){
$result_ratings = $data['result_ratings'] ;
**(I have successfully captured '$result_ratings' data here)**
$first_names = array_column($result_ratings, 'customer_id');
$data['result_cus'] =$this->mod_customers->get_unique_customer($first_names);
//var_dump($data['result_cus']); die();
data['related_view']='system_rating_appointments';
$this->load->view('template', $data);
}
我的型号代码(mod_customers)
public function get_unique_customer($first_names){
$this->load->database();
$this->db->where('id', $first_names);
$query = $this->db->get($this->table);
return $query->result_array();
}
结果
发生数据库错误
错误号:1054
“where 子句”中的未知列“数组”
选择 * 从tbl_customer 哪里id = Array
文件名:C:/wamp64/www/theme/system/database/DB_driver.php
行号:691
大家好,我是codeignitor的新手。我想从上表中检索数组的每个值的记录。但是发生了错误。请帮助我。
注意:在模型页面顶部定义的数据库、表
【问题讨论】:
-
提示:不要在 config/autoload.php
$autoload['libraries'] = array('database');中自动加载每个地方都使用$this->load->database(); -
这个我已经做了,非常感谢
标签: mysql codeigniter