例子:
$post=Post::model()->findByPk(10);
$post->title='new post title';
$post->save(); // save the change to database

// update the rows matching the specified condition
Post::model()->updateAll($attributes,$condition,$params);
例子:或者参考上面例子
$c=new CDbCriteria;
$c->condition='something=1';
$c->limit=10;
$a=array('name'=>'NewName');
Post::model()->updateAll($a, $c);

// update the rows matching the specified condition and primary key(s)
Post::model()->updateByPk($pk,$attributes,$condition,$params);
例子
$profile = profile::model()->updateByPk(
Yii::app()->user->user_id,
$attributes = array('pass' => md5($_POST['password']), 'role' => 1));

// update counter columns in the rows satisfying the specified conditions
Post::model()->updateCounters($counters,$condition,$params);