Yii: Using MySQL\'s IN condition with Active Record


/ Published in: PHP
Save to your folder(s)

When working with your model's search function or just grabbing some data with findAll, you can't add an IN condition to your condition clause. Fail:
<code>$criteria->condition = 'start=:startID AND end=:endID AND status IN (1,2,3)';</code>

Instead, use addInCondition:

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.