regenerate the ID row in a MySQL Table with a Mysql's Script or PHP

Posted by DomingoSL on Stack Overflow See other posts from Stack Overflow or by DomingoSL
Published on 2010-04-16T16:39:04Z Indexed on 2010/04/16 16:43 UTC
Read the original article Hit count: 298

Filed under:
|
|

Hello, i have a database fill with information of the users who use my webpage. The table as many MySql tables have the ID parameters who is autoincrement. The issue is that when somebody eliminate his account from the site, in the database remain a jump in the sequence that i dont want cuz i have a script who fail if find some jump in the ID.

Ex.

ID Name PASS 1 Jhon 1234 2 Max 2233 3 Jorge 2232

If Max get out and a new user go in, this is what will happend.

ID Name PASS 1 Jhon 1234 4 NewU 1133 3 Jorge 2232

So what is the best way to erase some body from the data base in order to avoid this isuue, or if is not a way, its posible to do a PHP or MySql script who eliminate all the contents in the ID row and regenerate it in order? Thanks A lot! sorry for my english

© Stack Overflow or respective owner

Related posts about mysql

Related posts about autoincrement