【发布时间】:2016-03-05 07:50:28
【问题描述】:
我想使用 Active Record 将数组传递给 where_in。
我看到的参考链接很少,可以这样传递:
$this->db->where_in('id', array('20','15','22','42','86'));
查询:
$mts = $this->db->select('subcat_id')->get_where('subcategory_tbl', array('cat_id' => $cat_id));
$result = $mts->result_array();
但我的结果数组是这种形式的:
Array
(
[0] => Array
(
[subcat_id] => 12
)
[1] => Array
(
[subcat_id] => 13
)
)
那么我怎样才能将这个数组 id 传递给 where_in 子句呢?我在这里很困惑。
【问题讨论】:
标签: php codeigniter activerecord