Oh no! Where's the JavaScript?
Your Web browser does not have JavaScript enabled or does not support JavaScript. Please enable JavaScript on your Web browser to properly view this Web site, or upgrade to a Web browser that does support JavaScript.
Not a member yet? Click here to register.
Forgot Password?

PRoblem: New user gets userid=16777215

Asked Modified Viewed 7,883 times
Z
Zidane55
Z
  • Member, joined since
  • Contributed 90 posts on the community forums.
  • Started 26 threads in the forums
  • Started this discussions
asked
Member

Hello. When a new user registres on my site, he becomes the userid = 16777215 every time.

Does anyone know why this happens?

When a new user activates his account he get this message "your account is activated ... Duplicate entry '16777215' for key 'PRIMARY'

Can anyone help?
0 replies

24 posts

K
Korcsii
K
Former Senior Developer (v7.02) and Hungarian Translator
  • Member, joined since
  • Contributed 132 posts on the community forums.
  • Started 8 threads in the forums
answered
Member

Huh, you have a big site! :)

You should go to phpmyadmin, to the users table, and change user_id column's type from MEDIUMINT to INT (length might be 10 or so).

And well, you have to go trough all tables, and check, if there is any field where user's id is used. Those should be also changed. For example post_author in the posts table.
0 replies
P
PolarFox
P
  • Veteran Member, joined since
  • Contributed 1,633 posts on the community forums.
  • Started 29 threads in the forums
answered
Veteran Member

Do you have over 16b users?
0 replies
S
smokeman
S
  • Veteran Member, joined since
  • Contributed 920 posts on the community forums.
  • Started 79 threads in the forums
answered
Veteran Member

No no - he have 15 users. He asked for this on my site too.

I too thought it was because the limit of the type mediumint(8) whish has limit 16777215.

But there's 15 users - so I don't know what causes this.
0 replies
M
mawe4585
M
  • Member, joined since
  • Contributed 84 posts on the community forums.
  • Started 34 threads in the forums
answered
Member

maybe a defect of the mysql table so that the auto-inc counter is corrupt?
0 replies
S
smokeman
S
  • Veteran Member, joined since
  • Contributed 920 posts on the community forums.
  • Started 79 threads in the forums
answered
Veteran Member

I told him to repair the table too - that did not fix it.
0 replies
M
Moregelen
M
Oooooh.. is that what Deep Corruption does? Ooopsie...
.. so, how do I heal without Holy Radiance spam anyway? I forgot...
  • Junior Member, joined since
  • Contributed 37 posts on the community forums.
  • Started 3 threads in the forums
answered
Junior Member

Has he tried clearing the table completely? So that it is completely remade?

[syntaxhighlighter brush=php,first-line=1,highlight=0,collapse=false,html-script=false]dbquery('TRUNCATE TABLE ' . DB_USERS);[/syntaxhighlighter]

(truncate drops the table and then remakes it)

Then you can register a new account and manually set it as the super admin. Hopefully that will reset whatever happened to your increment key.
0 replies
Z
Zidane55
Z
  • Member, joined since
  • Contributed 90 posts on the community forums.
  • Started 26 threads in the forums
  • Started this discussions
answered
Member

I tried doing what he told me in post number 2. But now the userid changes to 16777216 and when I make a new user 16777217 and a new 16777218..

hmm
0 replies
K
Korcsii
K
Former Senior Developer (v7.02) and Hungarian Translator
  • Member, joined since
  • Contributed 132 posts on the community forums.
  • Started 8 threads in the forums
answered
Member

If you have only 15 users... set all user_id to 1,2,3...15, and then try to repair the table.
0 replies
P
PolarFox
P
  • Veteran Member, joined since
  • Contributed 1,633 posts on the community forums.
  • Started 29 threads in the forums
answered
Veteran Member

Quote

maybe a defect of the mysql table so that the auto-inc counter is corrupt?

agreed, you must fix counter, something like this

just an example, not for real use:

Quote

ALTER TABLE fusion_users AUTO_INCREMENT = _YOUR_MAXIMUM_USER_ID_

_YOUR_MAXIMUM_USER_ID_ - YOUR MAXIMUM real USER ID.
0 replies
Z
Zidane55
Z
  • Member, joined since
  • Contributed 90 posts on the community forums.
  • Started 26 threads in the forums
  • Started this discussions
answered
Member

Polarfox. How should I do this exactly?
0 replies
P
PolarFox
P
  • Veteran Member, joined since
  • Contributed 1,633 posts on the community forums.
  • Started 29 threads in the forums
answered
Veteran Member

Try to use (make some backup first)

replace 100 to your max user ID

[syntaxhighlighter brush=php,first-line=1,highlight=0,collapse=false,html-script=false]
<?php
dbquery("ALTER TABLE ".DB_USERS." AUTO_INCREMENT = 100"wink;
?>[/syntaxhighlighter]
0 replies
M
Moregelen
M
Oooooh.. is that what Deep Corruption does? Ooopsie...
.. so, how do I heal without Holy Radiance spam anyway? I forgot...
  • Junior Member, joined since
  • Contributed 37 posts on the community forums.
  • Started 3 threads in the forums
answered
Junior Member

Your webhost most likely has phpMyAdmin installed; you might want to just go in there and alter the structure of the table rather than running code. That way you have an interface to verify it worked as well. Just go to the OPERATIONS tab for the table and set the auto_increment field to the number of rows you have +1
0 replies
P
PolarFox
P
  • Veteran Member, joined since
  • Contributed 1,633 posts on the community forums.
  • Started 29 threads in the forums
answered
Veteran Member

Right.
0 replies
Z
Zidane55
Z
  • Member, joined since
  • Contributed 90 posts on the community forums.
  • Started 26 threads in the forums
  • Started this discussions
answered
Member

Okay. I have 15 user now. So I change the auto_increment field to 16 ?
0 replies
M
mawe4585
M
  • Member, joined since
  • Contributed 84 posts on the community forums.
  • Started 34 threads in the forums
answered
Member

change it to the MAX_CURRENT_USER_ID + 1
could be there was a user more who was deleted, so look for the user_id field.
0 replies
Z
Zidane55
Z
  • Member, joined since
  • Contributed 90 posts on the community forums.
  • Started 26 threads in the forums
  • Started this discussions
answered
Member

hm, how do I do that?

I went to operation inside the user_table and changed the auto_increment to 16. But how do I change it to MAX_CURRENT_USER_ID + 1 ?

Sorry, but I am a bit new in php and database :(
0 replies
J
JoiNNN
J
JoiNNN 10
  • Veteran Member, joined since
  • Contributed 850 posts on the community forums.
  • Started 100 threads in the forums
answered
Veteran Member

LOL.
MAX_CURRENT_USER_ID is the user_id with the highest value, in your case might be 15, highest user_id is not equal to the number of your registered users if you deleted a user for example.

img594.imageshack.us/img594/8195/84176221.png
img560.imageshack.us/img560/3669/65589553.png

If you done it already there's not need to change anything else. Do the new registered users have proper IDs?

Here is a complete script that will change the AUTO_INCREMENT based on user_id with the highest value, paste it in a custom page and preview it then delete it, don't save the page.
<?php
$result = dbquery("SELECT MAX(user_id) FROM ".DB_USERS);
$id = dbarray($result);
$maxid = $id['MAX(user_id)'] + 1;

$result = dbquery("ALTER TABLE ".DB_USERS." AUTO_INCREMENT = ".$maxid);
if ($result) {
echo "Success :)<br />New AUTO_INCREMENT = ".$maxid;
} else {
echo "Something went wrong :(<br />Please try again";
}
?
Edited by JoiNNN on 10-03-2012 22:50,
0 replies
K
Korcsii
K
Former Senior Developer (v7.02) and Hungarian Translator
  • Member, joined since
  • Contributed 132 posts on the community forums.
  • Started 8 threads in the forums
answered
Member

But the problem is that, his highest user id is about 16777215.

He have to delete all users with high user_id, or change the id to lower.
0 replies
M
Moregelen
M
Oooooh.. is that what Deep Corruption does? Ooopsie...
.. so, how do I heal without Holy Radiance spam anyway? I forgot...
  • Junior Member, joined since
  • Contributed 37 posts on the community forums.
  • Started 3 threads in the forums
answered
Junior Member

just stick this in a custom page

[syntaxhighlighter brush=php,first-line=1,highlight=0,collapse=false,html-script=false]<?php
$users = dbquery("SELECT user_name FROM " . DB_USERS . " ORDER BY user_id"wink;
$count = 1;
while ($user = dbarray($users)) {
dbquery("UPDATE " . DB_USERS . " SET user_id = " . $count . " WHERE user_name = '" . $user['user_name'] . "'"wink;
$count++;
}

dbquery("ALTER TABLE " . DB_USERS . " AUTO_INCREMENT = " . $count);

$users = dbquery('SELECT user_id,user_name FROM ' . DB_USERS . ' ORDER BY user_id'wink;
print "<table>";
while ($user = dbarray($users)) {
print "<tr><td>" . $user['user_name'] . "</td><td>" . $user['user_id'] . "</td></tr>";
}
print "</table>";
?>[/syntaxhighlighter]

and then preview the page. Should list all the user names and their new ids.
Edited by Moregelen on 11-03-2012 01:54,
0 replies

Labels

None yet

Statistics

  • Views 0 views
  • Posts 24 posts
  • Votes 0 votes
  • Topic users 7 members

7 participants

K
K
Former Senior Developer (v7.02) and Hungarian Translator
  • Member, joined since
  • Contributed 132 posts on the community forums.
  • Started 8 threads in the forums
S
S
  • Veteran Member, joined since
  • Contributed 920 posts on the community forums.
  • Started 79 threads in the forums
M
M
Oooooh.. is that what Deep Corruption does? Ooopsie...
.. so, how do I heal without Holy Radiance spam anyway? I forgot...
  • Junior Member, joined since
  • Contributed 37 posts on the community forums.
  • Started 3 threads in the forums
M
M
  • Member, joined since
  • Contributed 84 posts on the community forums.
  • Started 34 threads in the forums
P
P
  • Veteran Member, joined since
  • Contributed 1,633 posts on the community forums.
  • Started 29 threads in the forums
J
J
JoiNNN 10
  • Veteran Member, joined since
  • Contributed 850 posts on the community forums.
  • Started 100 threads in the forums
Z
Z
  • Member, joined since
  • Contributed 90 posts on the community forums.
  • Started 26 threads in the forums
  • Started this discussions

Notifications

Track thread

You are not receiving notifications from this thread.

Related Questions

Not yet