如何在Codeigniter事件记录SQL查询中使用圆括号符号?
例如如何完成
SELECT * FROM `shops` WHERE (`shopid` = '10' OR `shopid` = '11') AND `shopid` <> '18'
最佳答案
$where="(`shopid` = '10' OR `shopid` = '11')";
$ this-> db-> where($ where,NULL,FALSE);
并用于AND条件
$this->db->where('shopid <>', '18')
IE
$where="(`shopid` = '10' OR `shopid` = '11')";
$this->db->where($where, NULL, FALSE);
$this->db->where('shopid <>', '18')