Let me apologize in advance - I'm very new to Cake and this simple
problem is driving me crazy... I've looked all through the Wiki and
tutorials looking for an example like this.

I'd like to read a record from my database, change one or two of the
fields, and then save it back as a *new* record (a copy of the original
record).

As I understand it, to add a record, I just set the id as null, and
Cake interprets it as an SQL INSERT. However, when I run this code in
my controller, it creates THREE new records.

What I want to do is simple - take the original Applicant record
(schoolyear = 16) and copy them to a new record, with all the same
data, except that the schoolyear = 15.

                        $this->Applicant->id = $id;
                        $this->data = $this->Applicant->read();
                        $this->data['Applicant']['id'] = null;
                        $this->data['Applicant']['schoolyear_id'] = 15;
                        $this->Applicant->save($this->data['Applicant']);

What I get are three new records, all of them with the schoolyear = 15.
The original record remains.

What am I doing wrong?

Thanks!!!


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
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