[英]what's wrong with my select query in model php codeigniter?
here is my code :这是我的代码:
function getValue($id)
{
$this->db->select('value');
$this->db->where('id',$id);
$q = $this->db->get('ref_table');
$data = array_shift($q->result_array());
$result = $data['value'];
return $result;
}
when executed emerge error array conversion to string执行时出现错误数组转换为字符串
Error gives you the answer Array conversion to string错误给你答案数组转换为字符串
Try this尝试这个
In model在模型中
public function getValue($id)
{
$this->db->select('value');
$this->db->where('id',$id);
$q = $this->db->get('ref_table');
$result = $q->result_array();
return $result;
}
In Controller在控制器中
$data['value'] = $this->Model_name->getValue($id);
$this->load->view('my_view',$data)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.