hosted by liquidweb


Go Back   Web Hosting Talk : Web Hosting Main Forums : Programming Discussion : #1062 - Duplicate entry '23933-27243-0' for key 'membersid'
Reply

Programming Discussion Discussions related to web programming languages and other related issues. Topics may include configuration, optimization, practical usage and database connectivity.
Forum Jump

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

Reply Post New Thread In Programming Discussion Subscription
 
Send news tip View All Posts Thread Tools Search this Thread Display Modes
  #1  
Old 11-20-2011, 01:23 PM
basketmen basketmen is offline
WHT Addict
 
Join Date: Jul 2007
Posts: 131

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


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 :

Quote:
update `account` set categoryid = replace (categoryid, '1' , '2');


but get this error message

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







- 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

__________________
Lets be stable diligent person

Reply With Quote


Sponsored Links
  #2  
Old 11-20-2011, 07:40 PM
MrKenTX MrKenTX is offline
Newbie
 
Join Date: Nov 2011
Posts: 6
Have you checked to see if there are more than one record in the account table with membersid of '23933-27243-0'?

Reply With Quote
  #3  
Old 11-20-2011, 09:05 PM
foobic foobic is online now
Community Liaison 2.0
 
Join Date: Feb 2005
Location: Australia
Posts: 5,111
Quote:
Originally Posted by MrKenTX View Post
Have you checked to see if there are more than one record in the account table with membersid of '23933-27243-0'?
Indeed, that does seem to be what the error message is telling you.

I'd also suggest extreme caution with queries like this:

Quote:
Originally Posted by basketmen View Post
Code:
update `account` set categoryid = replace (categoryid, '1' , '2');
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:
Code:
UPDATE `account` set `categoryid` = 2 WHERE `categoryid` = 1;

__________________
Chris

"Learn from the mistakes of others. You can never live long enough to make them all yourself." - Groucho Marx

Reply With Quote
Sponsored Links
  #4  
Old 11-21-2011, 11:31 PM
Grumps Grumps is offline
Web Hosting Master
 
Join Date: May 2005
Posts: 963
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.

Reply With Quote
Reply

Similar Threads
Thread Thread Starter Forum Replies Last Post
On Duplicate Key Delete aradapilot Programming Discussion 16 06-04-2009 04:44 PM
PHPizabi / Duplicate entry Issue NuPixel Programming Discussion 3 06-18-2008 08:35 PM
Mysql error 1062: Duplicate entry '0' for key 1 thetechaddict Programming Discussion 7 08-17-2006 06:07 PM
Man swallows key, locksmith uses xray to duplicate The Dude Web Hosting Lounge 7 06-26-2005 07:23 AM
[MySQL] Force Skip/Continue on Duplicate entry ??? PCplayground Programming Discussion 3 02-18-2004 07:26 PM

Related posts from TheWhir.com
Title Type Date Posted
Web Host Future Hosting Expands Footprint with Miami Data Center Web Hosting News 2012-07-30 16:49:01
Web Host Infinitely Virtual Reports Record Growth in 2011 Web Hosting News 2012-01-26 15:59:44
South Korea's Data Center Consolidation Model Saves Government $60M Web Hosting News 2011-12-30 16:57:46
Cloud Storage Firm TwinStrata Launches CloudArray Version 3.0 Web Hosting News 2011-11-15 18:14:36
Web Host Fasthosts Names Winners in Great Exhibition Competition Web Hosting News 2011-08-15 19:35:12


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes
Postbit Selector

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump
Login:
Log in with your username and password
Username:
Password:



Forgot Password?
Advertisement:
Web Hosting News:



 

X

Welcome to WebHostingTalk.com

Create your username to jump into the discussion!

WebHostingTalk.com is the largest, most influentual web hosting community on the Internet. Join us by filling in the form below.


(4 digit year)

Already a member?