|
PHP复制代码 $data = array();
$this->db->like('username', $keywords);
$this->db->or_like('name', $keywords);
$this->db->or_like('contact', $keywords);
$this->db->or_like('email', $keywords);
$this->db->where('status', $status);
$Q = $this->db->get('user', $num, $offset);
复制代码
出来的SQL语句是:SELECT * FROM (`ci_ccms_user`) WHERE `status` = '0' AND `username` LIKE '%%' OR `name` LIKE '%%' OR `contact` LIKE '%%' OR `email` LIKE '%%' ;
但是我想要的是:SELECT * FROM (`ci_ccms_user`) WHERE `status` = '0' AND (`username` LIKE '%%' OR `name` LIKE '%%' OR `contact` LIKE '%%' OR `email` LIKE '%%' )
或者大家有什么更好的解决方法吗? |
|