user warning: Duplicate entry '0' for key 1 query: INSERT INTO

hychanhan - August 7, 2009 - 05:06

Hi,

I am having a problem relate with users registration on drupal-6.12

When users start to register to my website i always appear an error message:

========================================

* user warning: Duplicate entry '0' for key 1 query: INSERT INTO khos_users (name, mail, timezone, pass, init, status, created) VALUES ('han0089', 'han0089@yahoo.com', 25200, '9cab589f3fe89130a17f9c7baa8123d8', 'han0089@yahoo.com', 1, 1249608555) in /home/virtualmin/wordforgefoundation.org/domains/khmeros.info/public_html/drupal612/modules/user/user.module on line 327.
* Error saving user account.

========================================

Please kindly help me now.

Best regards,
HY ChanHan

I'm getting the same problem with version 6.13

dontulio - August 14, 2009 - 18:29

I'm getting the same problem with version 6.13. I don't even know how long this has been going on. Apparently it wasn't working a few versions back either on my site.

Any solution to this?????

I tried a few things and got it to work.

dontulio - August 14, 2009 - 23:06

I tried a few things and got it to work. I couldn't do it through any editor though.

NOTE: This worked for me, so make sure you back up your database (don't overwrite your local backup)

I exported the SQL and searched for `users. I then manually made the following changes with notepad and restored from the modified file:

>>>>>>

FROM

`uid` int(10) unsigned NOT NULL default '0',

TO

`uid` int(10) unsigned NOT NULL auto_increment,

<<<<<<

Removing the default "0" and setting to auto_increment seemed to do the trick. I don't know if I've broken anything else while trying to fix this, but then again, my site has been broken for a while.

I hope this helps.

I will not claim to know SQL or MySQL. I just tried until something worked. If anyone has a more elegant alternative, please post.

 
 

Drupal is a registered trademark of Dries Buytaert.