stevenrfc Posted June 23, 2012 Posted June 23, 2012 Hello, Im still a noob at all of this php stuff, but i am learning (Slowly but surely getting there lol) When I delete a user then that ID will disappear and the next person registered will continue on from the next id. For example: Lets say i had two users, then i deleted the User with ID 2, then the next person who registers will be ID 3. So it will Jump from ID 1 to ID 3 Is there anyway i could change this, so that there isnt a gap? Thank you. Quote
Djkanna Posted June 23, 2012 Posted June 23, 2012 (edited) You can manually set the AUTO_INCREMENT value. (in some cases setting it to 1 will work fine, others not so much) But I'd advise against doing that, a lot of other tables depend on this. For example; Old User 2: Items: 20; Gang: Generals. Unread Mails: 40; Events: 32; Bank Money: $25,000. -Old user Delete (DELETE FROM `users` WHERE `userid` = 2 (I believe this is how and all MCCodes does in regard to removing users.) New user signs up, automatically assigned userid 2. New User: Items: 20; Gang: Generals. (the way it's set up or was, this user will be the leader, but will have no record of it in the users table.) Unread Mails: 40; Events: 32; Bank Money: $25,000. See the issue? Edited June 23, 2012 by Djkanna Quote
stevenrfc Posted June 23, 2012 Author Posted June 23, 2012 I'm sorry i do not see it. Im really a noob at this stuff, Only just started learning php not long ago but thank you for your reply. :) Quote
Djkanna Posted June 23, 2012 Posted June 23, 2012 Essentially the issue is the new user will have all the old users stuff. Quote
stevenrfc Posted June 23, 2012 Author Posted June 23, 2012 Ah i see, thank you. Is there any other way around this? Quote
Djkanna Posted June 24, 2012 Posted June 24, 2012 Ah i see, thank you. Is there any other way around this? Of course, edit MCCodes to delete everything that ties to a user when you delete a user. :) Quote
rulerofzu Posted June 24, 2012 Posted June 24, 2012 You would need to delete user userstats mail events inventory attack refs any other modification that stored a user Take the userid and then reset all the tables that auto increment with ALTER TABLE users AUTO_INCREMENT = the number you wish to reset it to. Issue with this in a live game is what if someone registers whilst your doing the above? You would need to close registrations everytime you need to do it. Personally i wouldnt bother about it. Its probably only an issue for you whilst testing creating your game after which you can reset and it will be fine afterwards. Quote
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.