Gang-Life Posted January 4, 2014 Share Posted January 4, 2014 (edited) I'm having a big problem & need your help, I drop all my users to be able to start from userid=1 but it keeps shooting back up to id=236 I've dropped almost every table in phpMyadmin but it still keeps counting from 237 :mad: It has made me wanna cry so I'm asking for help now if($_REQUEST['ref']) { $q=$db->query("SELECT * FROM users WHERE userid={$_REQUEST['ref']}"); $r=$db->fetch_row($q); } $zone=mt_rand(1,4); $db->query("INSERT INTO users (username, login_name, userpass, level, money, bankmoney, zone, gold, donatordays, adminlawl, energy, maxenergy, will, maxwill, brave, maxbrave, hp, maxhp, location, gender, signedup, email, lastip, lastip_signup, display_pic, layout) VALUES( '{$username}', '{$username}', md5('{$_POST['password']}'), 1, 200, 2000, $zone, 0, 3, 1, 100, 100, 5, 5, 5, 5, 20, 20, 1, '{$_POST['gender']}', unix_timestamp(), '{$_POST['email']}', '$IP', '$IP', 'images/noavatar.jpg', 4)"); $i=$db->insert_id(); $db->query("INSERT INTO userstats VALUES($i, 2, 2, 2, 2, 2)"); $db->query("INSERT INTO network_friends_top VALUES('', $i, 1, '', '', '', '', '', '', '')"); $db->query("INSERT INTO network_friends_approved VALUES('', $i, 1,UNIX_TIMESTAMP())"); $db->query("UPDATE users SET fightrank=$i WHERE userid=$i"); $pass = md5($_POST['password']); if ($_REQUEST['ref']) Edited January 4, 2014 by Gang-Life Quote Link to comment Share on other sites More sharing options...
Script47 Posted January 4, 2014 Share Posted January 4, 2014 (edited) Open PMA Click on the DB you're using Then on the `users` table Look on the top where it has all the control links Click "Operations" or something like that Look for something which says auto increment change it will have a number in it Change it to what you want [ATTACH=CONFIG]1271[/ATTACH] [ATTACH=CONFIG]1272[/ATTACH] I emptied table, why does the ID still come out as that? Because all you did was clear the data from the table, meaning you never changed the A_I value. How should I clear a table and change A_I value? In the future you should Truncate the table instead, that removes all the data and changes increment back to 1. [ATTACH=CONFIG]1273[/ATTACH] Edited January 4, 2014 by Script47 Quote Link to comment Share on other sites More sharing options...
Seker Posted January 4, 2014 Share Posted January 4, 2014 Or, for the sake of simplicity... ALTER TABLE `users` AUTO_INCREMENT = 1; For future reference: http://lmgtfy.com/?q=mysql+reset+auto+increment Quote Link to comment Share on other sites More sharing options...
Script47 Posted January 4, 2014 Share Posted January 4, 2014 (edited) Or, for the sake of simplicity... ALTER TABLE `users` AUTO_INCREMENT = 1; For future reference: http://lmgtfy.com/?q=mysql+reset+auto+increment Good point, I just thought I would explain it all. Thinking about it I probably should have just told him this haha. Got to love IMGTFY. :p Edited January 4, 2014 by Script47 Quote Link to comment Share on other sites More sharing options...
KyleMassacre Posted January 4, 2014 Share Posted January 4, 2014 don't forget about userstats as well. Granted its not on auto increment but be sure that the users id matches with that table on insert. so if you truncate users you may as well truncate userstats so they will match Quote Link to comment Share on other sites More sharing options...
SRB Posted January 5, 2014 Share Posted January 5, 2014 TRUNCATE TABLE `users`; Simple enough. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.