Jump to content

Archived

This topic is now archived and is closed to further replies.

freakus_maximus

mysql error - Duplicate Key 1

Recommended Posts

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?

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.