please wait

  • Priyanka Chadda Dec-24-2018 10:33:02 AM ( 4 months ago )

    How to apply where condition in yii2.

  • Amie Khalifa Dec-24-2018 10:34:03 AM ( 4 months ago )

    CDbCriteria represents a query criteria, such as conditions, ordering by, limit/offset. 


    It can be used in AR query methods such as CActiveRecord::find and CActiveRecord::findAll. 


    $criteria=new CDbCriteria(); $criteria->compare('status',Post::STATUS_ACTIVE); $criteria->addInCondition('id',array(1,2,3,4,5,6)); 


    $posts = Post::model()->findAll($criteria);

Please login

Similar Discussion

Recommended For You