$exemple = exemple::model()->findAll("userid=:uid and statut='1'", array(":userid" => Yii::app()->user->id));
Please how to select just the last record of the user ?
becouse in the code i select all the records of user which is connected and has in statut = 1 . but i want to select just the last record of the user which has in status = 1 .
i don’t know how to use limit and order by in the query
public function scopes()
{
return array(
'lastRecord'=>array(
'condition'=>'userid = '.Yii::app()->user->id.' AND status = 1',
'order'=>'orderField DESC',
'limit'=>1,
),
);
}
hey I Have a field pid(Portal Id) and uid(User ID) in my tbl_user_account table. uid is the primary key of the table.For the Different Pid I have to make the uid example
public function scopes()
{
return array(
'lastRecord'=>array(
'condition'=>'userid = '.Yii::app()->user->id.' AND status = 1',
'order'=>'"orderField" DESC',
'limit'=>1,
),
);
}