How in Yii save/update field via SQL query?
example
$model = new Table();
$model-> field_for_create = ‘NOW()’; // OR SQL like this “other_field+field_count*5”
$model-> save();
How in Yii save/update field via SQL query?
example
$model = new Table();
$model-> field_for_create = ‘NOW()’; // OR SQL like this “other_field+field_count*5”
$model-> save();
Use CDbExpression() instead:
$model = new Table();
$model->field_for_create = new CDbExpression('NOW()'); // or new CDbExpression('other_field+field_count*5');
$model->save(false);
To write plain sql statements check this link :
http://www.yiiframework.com/doc/guide/1.1/en/database.query-builder