yii query builder how to construct IN condition mix with other AND condition?

i am doing an SQL result filtering class. i need help to use IN condition mixed with other AND condition in WHERE.

I putting IN condition in string…

the result is


FROM table

WHERE a.user_id IN (:user)

Bound with :user=‘147,148,149’

this dont work.

i saw this http://www.yiiframework.com/doc/guide/1.1/en/database.query-builder

i know it is telling me to do in Array way.

->where(array(‘in’, ‘user_id’, array(1, 2,3))

but my class need to construct the query string and query param dynamic. there will mix with other AND condition such as date range… can anyone tell me how to do IN condition with query builder in STRING? instead of ARRAY

you can use explode function to convert your string into array like below

$user= ‘147,148,149’;

$arr_user = explode(",", $user);

$arr_user array can be used in where condition