How to set more than one condition in $criteria->condition

  thanks

The condition property takes a string. That means that you can have any number of conditions, concatenated with a logical AND or OR. So, your code should look like:

$criteria->condition='type=:type OR no_session=:no_session OR no_break=:no_break';

And the usual parameters binding.

Since 1.0.5 you can do this:



$criteria->condition = 'someField=:someField';


$criteria->params=array(':someField'=>$someField)


$otherCriteria->condition = 'someField2=:someField2';


$otherCriteria->params=array(':someField2'=>$someField2)


$criteria->mergeWith($otherCriteria);


thank you very much.  but its not working some error as "CDbException

Description

CDbCommand failed to execute the SQL statement: SQLSTATE[HY093]: Invalid parameter number: number of bound variables does not match number of tokens"

Check you placeholders ':someField'.

specify conditions separately and use mergeWith property like this

criteria->condition=" ";

criteria1=mergeWith(criteria);

and execute criteria1…

hope it will be useful for u