But instead I end up with the following:

001  user1
003  user3

Any idea or comment?

The auto incrementing feature of mysql unfortunately will always increase by
1 based on the (MAX) primary key ID number.  Questions about this have been
made to the MySQL development team as to if they would make it so MySQL
would fill in gaps in the ID key numbers however they said they have no
plans for doing such a thing (at least when I last inquired hehe)

If you wish to change it so you have the IDs

001 user1
002 user3

You would need to reset the database (ie  DELETE FROM table1;) and then
repopulate the database with all the information.  This of course would
reset the IDs for all of the records so make sure it is what you truly wish
to do.  Another option of course is to never delete any rows and instead
have a boolean field you can use to mark active/inactive records and set all
your queries to only search records with the active flag.

However in my opinion....unless you have a specific reason why you would
want all the primary keys to be in order you shouldn't concern yourself with
it.  As long as you routinely remove all the deleted records from the table
having the primary key not in numerical synchronization will not cause you
any performance problems.


Craig Vincent

PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to