On 20-Oct-2006, at 14:48, Gil Vidals wrote:

>
> Why is it necessary, when adding multiple records in a while or for
> loop to set the active record's id to null???
>
>      $this->Model->id = 'null';
>      $this->Model->save(...)
>
> If the active record's id is *not* set to null, only the first record
> is inserted and the rest simply do an update to the first record.
> Isn't there a way to set id to null within the save. Hey may be I
> answered my own question.
>
> I'll try $this->save('id' => 'null', 'otherstuff' => 'stuff') to see
> if that works.

Call

$this->Model->create();
$this->Model->save($data);

When creating new records. Other wise Cake assumes you are modifying  
the record previously saved.

s.

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

Reply via email to