Yii 1.0 Query Builder Code Demo

{Code}

$user = Yii::app()->db->createCommand()
    ->select('id, username, profile')
    ->from('tbl_user u')
    ->join('tbl_profile p', 'u.id=p.user_id')
    ->where('id=:id', array(':id'=>$id))
    ->queryRow();

 

{Boy Say}

The Yii Query Builder provides an object-oriented way of writing SQL statements.