Jump to content


Photo

mysql error - Duplicate Key 1


  • Please log in to reply
1 reply to this topic

#1 freakus_maximus

freakus_maximus
  • Members
  • PipPipPip
  • Advanced Member
  • 177 posts

Posted 20 April 2006 - 01:44 PM

Here's an odd one...hoping someone has run into this and may have a clue...

If I start with an empty table (my "id" field is set to autoincrement and is the primary key) any updates I do with my form all work just fine.

But, if I import (through phpMyAdmin) a data file and fill in the table and then later try and do an update through my form I get a duplicate key 1 error.

My form handles checking for existing "defectnumber" and the table does not allow duplicates on that field.

I went back and emptied the table again just to check and my updates work fine from the form.

Any ideas what could be the problem that only after importing I get a duplicate key 1 error?

#2 jworisek

jworisek
  • Members
  • PipPipPip
  • Advanced Member
  • 112 posts

Posted 20 April 2006 - 03:26 PM

try importing the data, then removing the primary key and try to insert data into the table... could it be that when you import this data file it isn't updating the position for the unique ID that you use? so after importing its still trying to dump it in at 1 when 1 already exists?

You could also try setting your id value to a number you know isno't already in the table to see if that still causes the error.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users