I would just set the ID first since you want it in both conditions (if
there is form data and if there is form data).

function edit($id) {
    $this->product->id = $id;
    ....

But there should also be some validation that the user really does
have access to edit that profile. I'm assuming this is a function for
your users to update their own profiles... It would probably be better
to get the user_id from the session and not a hidden variable (which
can easily be changed client side).

-Jon


On Jan 30, 8:05 am, "Matias Lespiau" <[EMAIL PROTECTED]> wrote:
> I think you will have to set your model's id  manually like this:
>
> function edit($id){
>        if (empty($this->data)) {
>                $this->product->id = $id;
>        $this->data = $this->product->read();
>        }else{
>                $this->product->id = $this->data['product']['id'];
>                if($this->product->save($this->data['product'])){
>
> >                        $this->Session->setFlash('Updated Sucessfully');
> >                        $this->redirect('/product/account_settings');
>
> >                }else{
> >                        $this->Session->setFlash('Please correct the
> > errors');
> >                }
> >        }
>
> >  }
>
> That should fix it.
>
> Cheers,
>
> --
> Matias Lespiauhttp://www.gignus.com/

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to