To update a a field in the database in cakephp we uses an array,
the task is done as,
$this->request->id = $id;
$data=array();
$data['User']['id'] = $this->request->id;
$data['User']['fname'] = $filename;
$this->User->save($data);
In the above code the array $data is created which stores the user id and the file name in the array and updates the user's fname on that id.
$this->User->save($data); This statement performs the saving part.
0 Comment(s)