Now my need is to update my profile in two tables users and usersprofile table.
i use the below code for updation, but it only update in user table, not in userprofile table. instead of update in userprofile, it is inserted the data in a new row. i dont know why? userid is the common field for both the tables. the users table id is stored in usersprofile tables as foreign key. function edit($id){ if (empty($this->data)) { $this->User->id = $id; $this->data = $this->User->read(); }else{ <! user table code starts---------------------> $foo = $this->User->find($this->data['User'] ['id']); if( $foo > 0 ) { $this->data['User']['id'] = $this->data['User']['id']; $this->data['User']['user_email'] = $this->data['User'] ['user_name']; $this->data['User']['user_password'] = md5($this->data['User']['user_password']); $this->User->save($this->data); }else{ $this->Session->setFlash('Please correct the errors'); $this->redirect('/users/account_settings'); } <! User Table code ends----------------> <! Userprofile Table code starts--------------> $good=$this->UserProfile->findByUserId($this- >data['User']['id']); $note = $this->UserProfile->find($good['UserProfile'] ['id']); I get the id of the userprofile table and did the same process what i did for the users table, but it will insert a data in a new row.it wont update my data. if($note > 0){ $this->UserProfile->save($this->data); $this->Session->setFlash($good['UserProfile']['id']); $this->redirect('/users/account_settings'); }else{ $this->Session->setFlash('Please check'); $this->redirect('/users/account_settings'); } <! Userprofile Table code ends-----------------> } } i use this code for update my profile, but it only update my profile in users table not in users profile table. instead of update, it will insert the data in usersprofile table in a next row, i dont know why? --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~----------~----~----~----~------~----~------~--~---