I would like to bring in php to a CDbCommand query where id=:id
. I would like to do id=: $model->id
.
$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')
->queryRow();
Try this: ->where('id=:id', array(':id'=> $model->id))
.
In where clause you can match attribute to an parameter value and then specify parameter value using an associative array.
Where('id=:id',array(':id'=> $model->id)).