【发布时间】:2012-03-07 20:10:01
【问题描述】:
我正在尝试使用 codeigniter 删除多条记录
$this->db->delete() and $this->db->where()
我想删除带有类似数组的记录
$id =array(
0=>'13', //13 is the id
1=>'4', //4 is the id
2=>'2' //2 is the id
);
数组是由用户生成的,所以它是动态的。 我只想知道codeigniter是否可以将数组作为删除方法中的一个选项。
据此。 http://codeigniter.com/user_guide/database/active_record.html
数组在以下方法中不起作用。
$this->db->delete()
$this->db->where('id', $id); //I don't think I can do this.
我可以使用 foreach 进行循环,但在我看来还有更好的方法。我想知道是否有人可以帮助我。非常感谢。
【问题讨论】:
标签: mysql codeigniter