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
执行时emerge错误数组转换为字符串
1 个解决方案
#1
1
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)
#1
1
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)