As kionae mentioned, every record in cake is refererred with respect
to the column 'id' and that is why the user manual also presses you to
have the id as the primary key for all your tables.

So if you are updating the record, make sure you have either

1. read the record in the model before you issue save  or
2. have the id in the data that you are saving.

Also, if you are updating one field, make sure you pass only that
field in the save argument, this will save you time, trouble and close
many security loopholes.

Ketan


kionae wrote:
> Try passing the user id along with the user name and password to the
> save function.  If it doesn't know which record to edit, it'll always
> just create a new one.
>
> On Aug 1, 9:40 am, apadzik <[EMAIL PROTECTED]> wrote:
> > Thank you very much!!:-))))
> >
> > Maybe there's another function for updating record?
> >
> > For example I have table customers and i have password reminder which
> > sets new password for customer.
> > When i generate password as $newPass and try to set it for user like
> > this:
> > $this->data['Customer']['login_name']=$_SESSION['login'];
> > $this->data['Customer']['password']=md5($newPass);
> > $this->Customer->save($this->data);
> >
> > it created me new record with all fields like first_name, last_name
> > etc. blank expcept for login_name and password.
> > Thanks in advance:)


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