Duplicate entry?

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
GeXus
Forum Regular
Posts: 631
Joined: Sat Mar 11, 2006 8:59 am

Duplicate entry?

Post by GeXus »

I'm receiving the following error
Duplicate entry 'xxxxx' for key 2
But, it is not a duplicate, if i do the exact same insert statement from command line it works... (and then i deleted it to try again).. and when i select on it, there is none existing..

Any idea why I would get this error?
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Are you sure you're looking at the correct key?
GeXus
Forum Regular
Posts: 631
Joined: Sat Mar 11, 2006 8:59 am

Post by GeXus »

There are only two keys and one is auto_increment so there is only one option
User avatar
Kieran Huggins
DevNet Master
Posts: 3635
Joined: Wed Dec 06, 2006 4:14 pm
Location: Toronto, Canada
Contact:

Post by Kieran Huggins »

post your query?
GeXus
Forum Regular
Posts: 631
Joined: Sat Mar 11, 2006 8:59 am

Post by GeXus »

Code: Select all

insert into review (user, review, date) values ('testuser', 'this is a test review', now())
there is a review_id that is auto increment and user is unique.
User avatar
Kieran Huggins
DevNet Master
Posts: 3635
Joined: Wed Dec 06, 2006 4:14 pm
Location: Toronto, Canada
Contact:

Post by Kieran Huggins »

Is `user` a key/unique?
GeXus
Forum Regular
Posts: 631
Joined: Sat Mar 11, 2006 8:59 am

Post by GeXus »

I got it, it's because i'm using cascading. Thanks anyways!
Post Reply