Reputation: 4607
I want to execute this query :
update table_name where field=field+1
what I'm trying to do is :
$model->updateAll(array("field"=>"field+1"),"id = ".$id);
field is integer , and after that running this code it updates to 0 .
does this syntax is wrong for $model->updateAll
?
do I have to use another function ?
Upvotes: 1
Views: 1773
Reputation: 4607
$model->updateAll
can't do this , the correct function that I should use is:
$model->updateCounters(array("field"=>"1"),"id = ".$id);
Upvotes: 1