I'd venture a guess that if your id column in the database is auto_incrementing (which it should be), it usually can't be 0. Hence Cake doesn't care about 0 ids.
On 9 Sep 2008, at 20:06, John Jackson wrote: > > Thanks for the reply, but I now know that is the correct way to > perform an update as I have just figured out what the problem was. > Apparently, I can not use an id of 0. Changing the user's id to > another value greater than 0 fixed the problem. > > Is this a bug or intended functionality? > > On Sep 9, 11:58 am, "[EMAIL PROTECTED]" > <[EMAIL PROTECTED]> wrote: >> Hi John, >> When calling save the id should be part of the data. Setting it on >> the >> Model before saving does not work as you expect it to. >> Are you sure the id is in the data array? >> >> /Martin >> >> On Sep 9, 12:34 pm, John Jackson <[EMAIL PROTECTED]> wrote: >> >>> Pretty sure the code I'm using should be causing the save() function >>> to do a MySQL update instead of insert: >> >>> $this->User->id = 0; // static here for this example >>> $this->User->save($this->data); >> >>> But this is resulting in an insert, according to the output from >>> debug >>> level 2. What I'm trying to do is update a user's details for their >>> account, including name, email and password. >> >> > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "CakePHP" 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 -~----------~----~----~----~------~----~------~--~---
