The method of yii updating database data is as follows:
Customer::updateAll(['status' => 1], ['status'=> '2','uid'=>'1']);
is equivalent to:
(recommended tutorial: yii framework)
update customer set status = 1 where status = 2 and uid = 1;
Note: It cannot be written in the following form:
Customer::find()-> updateAll(['status' => 1], ['status'=> '2','uid'=>'1']);
For more programming-related content, please visit the Programming Tutorial column of the php Chinese website!
The above is the detailed content of How to update database data in yii. For more information, please follow other related articles on the PHP Chinese website!