我从以下代码中收到以下错误:
类CI_DB_mysql_result的对象无法转换为字符串
$cari = $this->db->query("select sum( biaya )
FROM bahanbenang
WHERE id_benang
IN ($benang) ");
我该如何纠正?
答案 0 :(得分:0)
你可以像这样
$this->db->select('sum( biaya )')
->from('bahanbenang')
->where('seen', 0)
->where_in('id_benang',$benang);
return $data->row();
答案 1 :(得分:0)
您运行查询但必须检索其结果
$query = $this->db->query("select sum( biaya )
FROM bahanbenang
WHERE id_benang
IN ($benang) ");
$cari = $query->result(); //this will return an array of objects. Each object is a row from the query
其他结果方法{{3}}。