db col name as a variable


I am passing in a db col name as a parameter via ajax to a controller. The column name can change. My question is how do I specify to the model what the col name is that I want to update. eg…

$set = Yii::app()->getRequest()->getParam(‘set’); // col name from ajax, will be set to ‘username’ for example

$m = CanoeKayak::model()->find(




':user_id' => $this->user_id,




$m->WHAT DO I PUT HERE TO UPDATE THE COL USERNAME FROM $set ABOVE = ‘new value for username’


Hope this is simple :)

Thanks for any help

$m->$set = "new value";