Help with MySQL
#1

Hello, is any method to rearrange the ID of a table, like i have a house system and i create a wrong house, i delete him from the database where his id were 1 and if i create a new house it will be 2, how can i make that id to be 1 or whatever number is the succesive of the last id created

And if are much houses, when i remove a house can i rearrange all to have succesive id's?
Reply
#2

you have to use the Auto Increment function
Reply
#3

I use that, but that will happen, if i delete first id, then the next id will not be 1 will be 2


Reply
#4

use this and try again
PHP код:
ALTER TABLE tablename AUTO_INCREMENT 
or

In phpMyAdmin, click on the table you want to reset or change the AUTO_INCREMENT value,go to operations,find the auto increment field and enter the new startin value ( 1 ) ,click go and see if it increments them corectly.
Reply
#5

If is AI you can't get the deleted ID back because that will generate some kind of errors in the mysql(actually not, but the next inserted row generate errors if that ID is in use)
You can delete the AI but you need to insert manually the IDs so the IDs will be as you want
Reply
#6

I want only to rearange the id's not to insert manually a new ID
Reply
#7

if you delete a house,and for example id 2 will become id 1,you`re gonna have some problems(like a player owning the house id 2,after you delete house id 1 he`ll own the id 3 ( before delete) because it`ll become the new id 2.why whould you do that?
Reply
#8

Ok, i solved, i will drop the column id and i will add again and all will be arranged, now i have a problem with /removehouse command, this will not remove the pickup and label from some houses, not from all
Reply
#9

I solved and that, thank all for help!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)