Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • How to update a field in the database in cakephp 2.x

    • 0
    • 1
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 103
    Comment on it

    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)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: