我得到错误数组到字符串转换我的控制器是function index() { if ($this->input->post('submit') != NULL) { $data = array(); $data['username'] = $this->input->post('username'); $data['name'] = $this->input->post('name'); $result['data'] = $this->Useraccount_mod->getUser_list($data); $data['userlist'] = $result['data']; $this->load->view('Useraccount/Userlist', $data); } else { $data = array(); $result['data'] = $this->Useraccount_mod->getUser_list($data); $data['userlist'] = $result['data']; $this->load->view('Useraccount/Userlist', $data); } }和型号 function getUser_list($data) { if ($data) { $this->db->like('username',$data); $this->db->like('name',$data); $query = $this->db->get('users'); return $query->result_array(); } else { $query = $this->db->get("users"); return $query->result_array(); } }我错在哪里?请建议我严重性:通知消息:数组到字符串的转换文件名:数据库/DB_query_builder.php行号:980回溯:文件:C:\xampp\htdocs\ov400\application\models\Useraccount_mod.php 行:31 功能:like文件:C:\xampp\htdocs\ov400\application\controllers\Users.php 行:23 功能:getUser_list文件:C:\xampp\htdocs\ov400\index.php 行:315 功能:require_once
1 回答
幕布斯7119047
TA贡献1794条经验 获得超8个赞
您正在尝试在“喜欢”中提供数组作为信息。请试试这个:
function getUser_list($data) {
if ($data) {
$this->db->like('username',$data['username']);
$this->db->like('name',$data['name']);
$query = $this->db->get('users');
return $query->result_array();
} else {
$query = $this->db->get("users");
return $query->result_array();
}
}
- 1 回答
- 0 关注
- 107 浏览
添加回答
举报
0/150
提交
取消