【发布时间】:2015-09-17 09:52:39
【问题描述】:
我正在尝试转换此查询:
SELECT * FROM table WHERE condition1 = 'example' AND (date1 = 'date' OR renewal1 = 'renewal');
进入 CodeIgniter 的 Active Record 格式。我尝试了以下方法:
$q = $this->db->select('*');
$q = $this->db->from('table');
$q = $this->db->where('condition1 = condition');
$q = $this->db->where('date1 = date OR renewal = renewal');
$q = $this->db->get();
$results = $q->result();
但这并没有达到预期的效果。它似乎没有在第二组条件周围放置括号,这导致查询无法按预期工作。我还能怎么做才能代表我想要的?
感谢您的帮助!
【问题讨论】:
标签: php mysql codeigniter activerecord