On Aug 31, 2007, at 1:24 PM, [EMAIL PROTECTED] wrote:
> > I'm working on a CakePHP script running from the command-line. I'm > attempting to check for a record in table "foo", and if it doesn't > exist, I add a new record using the Model::save() method. Afterwards, > I immediately call Model::field() to try to capture the > auto_incremented "id" field so that I can do extra work relating to > that record. > > Problem is, when I call $this->controller->Foo->field( 'id', > $conditions ); immediately after the save, it returns null. In fact, > this happens every time for that record until the script has completed > and is run a second time. Have you tried using getLastInsertId() rather than field()? -- John --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
