我在代码点火器中使用多联接查询执行多重搜索,因此我执行 3 or_like查询。但是默认情况下,代码点火器在每个or_like查询之间放置了一个"OR"。但实际上我想在它们之间执行"AND"操作。请帮助我。 谢谢
or_like由
codeignitor提供给多个实例,由OR连接。所以,我认为没有办法用 AND 替换 OR。这是您可以尝试的另一种解决方案。
使用"like"和"or_like"使用where子句如下
$this->db->where('location LIKE', '%'.$your_location.'%');
$this->db->where('city LIKE', '%'.$your_city.'%');
我们可以在 codeigniter 版本 3.0 中非常简单地做到这一点
例如,
$this ->db ->select('*');
$this ->db ->where('age',$age);
$this ->db ->where('country',$country);
$this->db->group_start();
$this ->db ->or_where('state',$state);
$this ->db ->or_where('district',$district);
$this->db->group_end();
$query=$this ->db ->get('pg_reg');