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


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';


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



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


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=" ";


and execute criteria1…

hope it will be useful for u