Login
Username

Password



Not a member yet?
Click here to register.

Forgotten your password?
Request a new one here.
Navigation
Latest Addons
Xbox Leaderboards 8
Cookiebar Panel 72
AD Gallery 151
SyntaxHighlighte... 63
Newsletters v4.03 168
Facebook Like Box 204
Newsletters v4.02 79
Metro 236
Facebook Connect 215
Shoutbox Panel 185
Redactor for PHP... 127
MI Floating Side... 133
Facebook Login/R... 180
Avatar Studio v2.03 215
Relationship Sta... 123
Popular Addons
iTheme2 5911
Arise 5871
User Control v1.23 4683
Event Calendar 4133
Photowidget panel 3923
Radio-Theme red2... 3396
Highslide Gallery 3361
CSS/JavaScript D... 3277
Facebook Connect... 3056
Dynamic Menu 2947
Slideshow Lightb... 2770
L-AMANT 2689
Enigma 2671
2Dark 2625
Black 2620
View Thread
Official Home of PHP-Fusion » General Addon and Modification Support » Ideas for Modifications and Requests
Who is here? 1 guest(s)
 Print Thread
PRoblem: New user gets userid=16777215
Zidane55
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?
 
Korcsii
Huh, you have a big site! Smile

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.
Senior Developer (v7.02)
php-fusion.co.hu
 
http://www.php-fusion.co.hu
PolarFox
Do you have over 16b users?
 
http://unlogic.info
smokeman
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.
 
http://www.phpfusion-tips.dk/
mawe4585
maybe a defect of the mysql table so that the auto-inc counter is corrupt?
 
smokeman
I told him to repair the table too - that did not fix it.
 
http://www.phpfusion-tips.dk/
Moregelen
Has he tried clearing the table completely? So that it is completely remade?

dbquery('TRUNCATE TABLE ' . DB_USERS);


(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.
Oooooh.. is that what Deep Corruption does? Ooopsie...
.. so, how do I heal without Holy Radiance spam anyway? I forgot...
 
http://unlockedpotential.net
Zidane55
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
 
Korcsii
If you have only 15 users... set all user_id to 1,2,3...15, and then try to repair the table.
Senior Developer (v7.02)
php-fusion.co.hu
 
http://www.php-fusion.co.hu
PolarFox
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:
ALTER TABLE fusion_users AUTO_INCREMENT = _YOUR_MAXIMUM_USER_ID_

_YOUR_MAXIMUM_USER_ID_ - YOUR MAXIMUM real USER ID.
 
http://unlogic.info
Zidane55
Polarfox. How should I do this exactly?
 
PolarFox
Try to use (make some backup first)

replace 100 to your max user ID


<?php
dbquery("ALTER TABLE ".DB_USERS." AUTO_INCREMENT = 100");
?>

 
http://unlogic.info
Moregelen
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
Oooooh.. is that what Deep Corruption does? Ooopsie...
.. so, how do I heal without Holy Radiance spam anyway? I forgot...
 
http://unlockedpotential.net
PolarFox
Right.
 
http://unlogic.info
Zidane55
Okay. I have 15 user now. So I change the auto_increment field to 16 ?
 
mawe4585
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.
 
Zidane55
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 Sad
 
JoiNNN
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.
Download source  Code
<?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 20:50
 
https://github.com/JoiNNN
Korcsii
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.
Senior Developer (v7.02)
php-fusion.co.hu
 
http://www.php-fusion.co.hu
Moregelen
just stick this in a custom page

<?php
$users = dbquery("SELECT user_name FROM " . DB_USERS . " ORDER BY user_id");
$count = 1;
while ($user = dbarray($users)) {
dbquery("UPDATE " . DB_USERS . " SET user_id = " . $count . " WHERE user_name = '" . $user['user_name'] . "'");
$count++;
}

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

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


and then preview the page. Should list all the user names and their new ids.
Edited by Moregelen on 10-03-2012 23:54
Oooooh.. is that what Deep Corruption does? Ooopsie...
.. so, how do I heal without Holy Radiance spam anyway? I forgot...
 
http://unlockedpotential.net
Jump to Forum:
Similar Threads
Thread Forum Replies Last Post
Move host problem Installation Issues 3 17-06-2013 21:10
Problem with transfering page from production to localhost Installation Issues 5 15-06-2013 10:21
User Groups In Profile Ideas for Modifications and Requests 8 10-06-2013 07:41
New user field system HOW TO User Administration 35 10-06-2013 06:56
Locale: move often user phrases to global.php Roadmap 15 01-06-2013 12:27
Official Home of PHP-Fusion uses cookies. Some may already have been set. Read more about our Cookies here.
Please click the button I Consent Cookies to hide this bar and accept our cookies. If you continue to use the site with no action taken, we'll assume that you consent our cookies anyway.
Cookiebar Panel byVenue