Updation in CakePHP is basically based on knowing the primary key(Id) of the records one wants to change/edit.
You can update a field in CakePhp by two ways:-
a)By using saveField method
$this->ModelName->id=$id;
$this->ModelName->saveField("fieldName","value");
b)By using updateAll method
$this->Model->updateAll(array("fieldName"=>"value"),array("fieldName"=>"condition"));
0 Comment(s)