error while doing IN query

Hi,

I am  trying to do IN query.

Following is my CDbCriteria object:

object(CDbCriteria)#74 (9) { [“select”]=>  array(4) { [0]=>  string(2) “id” [1]=>  string(4) “name” [2]=>  string(5) “state” [3]=>  string(9) “lead_time” } [“condition”]=>  array(2) { [0]=>  string(16) “user_id=:user_id” [1]=>  string(29) “state IN ( ‘NEW’,‘ASSIGNED’ )” } [“params”]=>  array(1) { [":user_id"]=>  string(3) “542” } [“limit”]=>  int(-1) [“offset”]=>  int(-1) [“order”]=>  string(0) “” [“group”]=>  string(0) “” [“join”]=>  string(0) “” [“having”]=>  string(0) “” }

But while running the query I am getting the following error messge:

CDbCommand failed to execute the SQL statement: SQLSTATE[42S22]: Column not found: 1054 Unknown column ‘Array’ in ‘where clause’

Can anyone help me on this?

Looks like you passed empty array() parameters into the SQL statement, please double check you php code or provide more details.

This is the corresponding query:

	$criteria=new CDbCriteria;


	$criteria->select=array ('id','name','state','lead_time'); 


 


	$states = array("NEW","ASSIGNED");


	$place_holders = array();


	foreach($states as $v) {


	   $place_holders[$v] = $v;


	}		





	$criteria->condition= array('user_id=:user_id',"state IN ( '" .implode("','",$place_holders). "' )");


		


	$criteria->params=array(':user_id'=> Yii::app()->user->id);

The 'condition' of criteria must be a string, not an array.

Oh my bad :(

Thanks a lot qiang