【发布时间】:2018-01-10 21:07:42
【问题描述】:
如何在 Codeigniter 中运行删除查询。我有一组数组和一个键。在 MySQL 中,我的查询运行完美。
DELETE FROM `TABLE` WHERE `style_id`=2 && `ID` NOT IN (5,9,12)
在 Codeigniter 中如何编写和运行这个查询。我尝试了下面的代码,但没有工作。
$ids = '5,9,12';
$this->db->where('style_id', $style_id)->where_not_in('ID', $ids);
$this->db->delete('TABLE');
【问题讨论】:
-
请告诉我 $id 的值。
标签: php mysql codeigniter activerecord query-builder