Php 如何在CodeIgniter中将数组传递到何处条件?
我正在应用程序中使用Php 如何在CodeIgniter中将数组传递到何处条件?,php,mysql,codeigniter,Php,Mysql,Codeigniter,我正在应用程序中使用CodeIgniter。我有这样的代码 $this->db->where('a.PreferenceID不在(选择PreferenceParentID 来自“$table.”,其中EntityID=“$shop_id.”),NULL,FALSE) 我想传递一个数组,而不是$shop\u id 像 等于 WHERE (EntityID='. $arr[0].' OR EntityID='. $arr[1].' OR EntityID='. $arr[2].') 因为我想检查多
CodeIgniter
。我有这样的代码
$this->db->where('a.PreferenceID不在(选择PreferenceParentID
来自“$table.”,其中EntityID=“$shop_id.”),NULL,FALSE)
我想传递一个数组,而不是$shop\u id
像
等于
WHERE (EntityID='. $arr[0].' OR EntityID='. $arr[1].' OR EntityID='. $arr[2].')
因为我想检查多个店铺id。最好的方法是什么?使用
'SELECT PreferenceParentID FROM '.$table.' WHERE EntityID IN ('.implode(',', $arr_id).')'
使用
在
子句中使用,如
$this->db->where('a.PreferenceID NOT IN (
SELECT PreferenceParentID FROM '.$table.'
WHERE EntityID IN ('.implode(",", $array).'))',
NULL, FALSE
);
在
子句中使用,如
$this->db->where('a.PreferenceID NOT IN (
SELECT PreferenceParentID FROM '.$table.'
WHERE EntityID IN ('.implode(",", $array).'))',
NULL, FALSE
);
试试像这样的东西
WHERE EntityID IN('.implode(',', $arr).')
试试像这样的东西
WHERE EntityID IN('.implode(',', $arr).')