Search code examples
phpactiverecord

PHP Active record - how to add not in condition in all() function


Can anyone please tell me what is the problem in using the not in condition in the following code:

$filter=implode(',',array(1,2));

$list = static::all(array('conditions' => array('org_grp_id = ? AND org_active = ? and     org_id not in (?)', $group, 1,$filter), 'order' => 'org_name'));

return $list;

For information, this all() function is from php ActiveRecord class.

Thanks


Solution

  • You should pass values for IN (?) as an array, not as a string.

    Try this:

    $filter = array(1, 2);