Reputation: 35
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
Upvotes: 2
Views: 122
Reputation: 38584
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)
Upvotes: 1