Jump to content
MakeWebGames

Recommended Posts

Posted

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.

Posted (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 by Djkanna
Posted

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.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...