It looks you are missing to set the id of the userprofile table in
your data array $this->data, as you did above for
$this->data['User']['id']; I mean try setting the id of your
userprofile table i.e.
$this->data['UserProfile']['id']
On Feb 1, 9:11 am, vinoth <[EMAIL PROTECTED]> wrote:
> Hi pals,
>
> i use this code to update my profile in two tables(users and
> usersprofile).
> email and password is to be update in users table and
> city,state,zipcode is to be update in userprofiles table.
>
> the relation between these two table is userid.
>
> this userid is stored in both the tables.
>
> while submit the form i passed this userid as a hidden variable.
>
> i want to update the data in both the tables.
>
> for that i write this code
>
> function edit($id){
> if (empty($this->data)) {
> $this->User->id = $id;
> $this->data = $this->User->read();
> }else{
>
> $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');
> }
>
>
> $good=$this->UserProfile->findByUserId($this->data['User']['id']);
>
> $note = $this->UserProfile->find($good['UserProfile']
> ['id']);
> 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');
> }
>
> }
>
> }
>
> it is updated email and password in users table correctly, the
> remaining data is stored in a userprofile table in a new row.
>
> how to update my profile in two tables.
>
> in userprofile it will stored in a next row.
> anybody help me to comeout from this issue.
>
> Thanx vinoth.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake
PHP" group.
To post to this group, send email to [email protected]
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
-~----------~----~----~----~------~----~------~--~---