在我的查询中不返回任何代码编写器.这段代码正在工作,但没有给出任何结果


In my query not return anything in codeigniter.This code is working but not give any result

<?php     
//image formation
$imag_sel=$this->db
->select('image')
->where(['id',$id1])
->get('borrow_user');
$fil=$imag_sel->result();//result for code
print_r($fil);//return image but not returning anthing it's gave "array()"
?>

问题出在"where"子句上。

Where's有两种方式:

方法1:

->where('field', $value)

将where子句连接在一起,例如:

$this->db
  ->where('name', $name)
  ->where('age', $age)
  ->get('table');

或者使用数组。

方法2:

$where = array(
    'name' => $name,
    'age' => $age,
);
$this->db
  ->where($where)
  ->get('table');

你也不需要把它们链起来。你可以按照程序来做:

$this->db->where('name', $name);
$this->db->where('age', $age);
// or
$this->db->where($where);
$this->db->get('table');

如果你有一个单一的where子句,第一个是干净的,但是如果有多个,它是更好的使用数组(也允许动态数组构建如果需要)

改变这一行

->where(['id',$id1])  

->where('id',$id1)