Yii - findAll with order by

前端 未结 3 1843
野性不改
野性不改 2021-01-14 06:56

How to findAll with specific column with order by desc ?

Code bellow worked and find all from the developer id

$id = Yii::app()->         


        
3条回答
  •  情歌与酒
    2021-01-14 07:35

    You can try use criteria:

    $id = Yii::app()->user->getState('id');
    $criteria=new CDbCriteria;
    $criteria->compare('developer_id',$id);
    $criteria->order='status DESC';
    
    $models = Games::model()->findAll($criteria);
    

提交回复
热议问题