Portal Home > Knowledgebase > Articles Database > #1062 - Duplicate entry '23933-27243-0' for key 'membersid'


#1062 - Duplicate entry '23933-27243-0' for key 'membersid'




Posted by basketmen, 11-20-2011, 01:23 PM
Hi guys, I have a table, the table name is account, its have 2 fields : membersid, and categoryid i want to change the categoryid field content, i run this in phpmyadmin : but get this error message - what should i do so i can change the field content? Please help. I already tried changing the field TYPE, from INT, to BIGINT, like other person suggested, but still get that error message - this is the screenshot from the field Structure http://i291.photobucket.com/albums/l...tmen/field.jpg

Posted by MrKenTX, 11-20-2011, 07:40 PM
Have you checked to see if there are more than one record in the account table with membersid of '23933-27243-0'?

Posted by foobic, 11-20-2011, 09:05 PM
Indeed, that does seem to be what the error message is telling you. I'd also suggest extreme caution with queries like this: That's using the data in categoryid (presumably integer) as a string, and replacing instances of 1 with 2. So 1 becomes 2, 100 becomes 200, 311 become 322 etc. What you probably want here is:

Posted by Grumps, 11-21-2011, 11:31 PM
It sounds to me like you have a multi-row unique index set. And changing this will violate that unique index. Check what keys you have setup. Then, really think to yourself, is this change something you REALLY want to do? Are you sure you aren't doing something that'll break your program? Otherwise, you wouldn't have made such a unique index. If yes, then just change the unique index to just index. This will resolve your duplicate key problem.



Was this answer helpful?

Add to Favourites Add to Favourites    Print this Article Print this Article

Also Read


Language: