1

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 ?

4

1 回答 1

1

$model->updateAll不能这样做,我应该使用的正确功能是:

$model->updateCounters(array("field"=>"1"),"id = ".$id);
于 2013-09-25T06:36:20.757 回答