Update By Primary Key
Model::model()->updateByPk($Model->id,array("status"=>'ok'));
Update All Rows
Model::model()->updateAll(array('user'=>"$userid",'date'=>$currenttime),"status=>'ok'");
yii, Executing a SQL without calling a Model <? $connection = Yii :: app () -> db ; $sql = "SELECT id,username FROM users" ; $command = $connection -> createCommand ( $sql ); $dataReader = $command -> query (); $rows = $dataReader -> readAll (); print_r ( $rows ); ?>