我正在尝试通过代码组合码和或在codeigniter中的位置。
$this->db->where("id",1);
$this->db->where("status","live")->or_where("status","dead");
表达结果为查询
where id=1 and status='live' OR status='dead'
where id=1 and (status='live' OR status='dead');
注:请不要给出字符串的解决方案作为参数从哪里函数传递。这不适合我的代码。我只是简化了上面的问题。
$this->db->where("id",1)->where("(status='live' OR status='dead')");
您只需添加 - > group_start()和 - > group_end()