Yii createCommand Update

Functions

function update($table, $columns, $conditions='', $params=array())

Sample

The update() method builds and executes an UPDATE SQL statement.

<?php
$user=Yii::app()->db->createCommand()
->update('tbl_user', array(
    'username'=>'bsourcecode',
), 'user_id=:id', array(':id'=>1));
?>    

OUTPUT SQL

  UPDATE `tbl_user` SET `username`=:username WHERE user_id=:id