Hey,
Sorry for the confusion. I just called it id_number when I was giving
an example of the URL .... i meant id. Thanks for the help. You led
me to my problem.
mySQL didn't have a starting auto_increment set on the table. I
altered it to 1. I altered the record with 0 as the id to be 1. I
then ran the script again and the the query it ran was an update
instead of a insert.
Thanks for the help.
This is my first cakePHP project and I'm really having a go at it
adjusting to the intricacies of the system.
On Jan 5, 8:14 pm, "Chris Hartjes" <[EMAIL PROTECTED]> wrote:
> On Jan 5, 2008 6:51 PM, Travis <[EMAIL PROTECTED]> wrote:
>
> > When I use $this->Customer->Save() this is the message I recieve ...
>
> > Query: INSERT INTO `customers`
> > (`name`,`street`,`city`,`state`,`zip`,`phone`,`id`,`modified`,`created`)
> > VALUES
> > ('thomas','','Lafayette','LA','70517','337-555-5555','0','2008-01-05
> > 17:48:02','2008-01-05')
>
> > Warning (512): SQL Error: 1062: Duplicate entry '0' for key 1 [CORE/
> > cake/libs/model/datasources/dbo_source.php, line 440]
>
> Well, what jumped out at me right away was the fact that your 'id'
> field is set to 0 in the statement above. So, because 'id' is 0, it
> keeps trying to insert a record with an 'id' of 0, which I am assuming
> is the primary key for that field. I'd also bet there is one record
> in there with an 'id' of 0, hence SQL complaints about duplicate
> entries.
>
> Now, bear with me here and please remember I am trying to help...
>
> You mention above that you have a field called 'id_number' that is
> supposed to be the primary key for the table. Well, in the above
> query I don't see any field called 'id_number'. So, that leads me to
> think that the primary key for the table must be 'id'.
>
> In order for the update to work, you need to make sure that
> $this->data['Customer']['id'] is set to some value because if it is
> missing, then it looks like (to me anyway) that it is defaulting to 0.
>
> Tell me if that makes sense.
>
> --
> Chris Hartjes
> Internet Loudmouth
> Motto for 2008: "Moving from herding elephants to handling snakes..."
> @TheKeyBoard:http://www.littlehart.net/atthekeyboard
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---