Re: Authomatic Sorting

From: Date: Thu, 05 Jul 2001 20:34:23 +0000
Subject: Re: Authomatic Sorting
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-10095@lists.php.net to get a copy of this message
Well, my comment on this is that the autoincrement field is giving you a primary key which is not changing, and this is good. Check the scripts you used to build the tables, and your MySQL docs for the MyISAM table type. When tables are defined as being of the type MyISAM, the autoincrement numbers don't change. In the newer versions of MySQL that may be the default and you will have to add tell MySQL to NOT use this table type. I don't know why you want to do this, as an unchanging, and really simple-to-implement primary key is a very useful feature, particularly as you can any sort order you desire in your SELECT statement. Regards - Miles Thompson At 10:10 AM 7/5/01 +0300, Dobromir Velev wrote:
When you delete a record it doesn't affect the other ones, so if you want to change the other ones you have to update them too. For this purpose I use the following SQL command after deleting a row: UPDATE table SET id_field=id_field-1 where id_field>deleted_ID_value I hope this will help Dobromir Velev -----Original Message----- From: Wilmar Pérez <wilmar.perez@caribe.udea.edu.co> To: PHP List <php-db@lists.php.net> Date: Wednesday, July 04, 2001 11:45 PM Subject: [PHP-DB] Authomatic Sorting Hello guys I have the following two problems: I've got a table with an autoincrement field which is the registry's ID, everything goes well until I delete any registry. MySQL doesn't re-sorts the information. That is, I have the following: 001 user1 002 user2 003 user3 If I delete user2, I would like to have something as shown next: 001 user1 002 user3 But instead I end up with the following: 001 user1 003 user3 Any idea or comment? -----------------------------------------------
               Wilmar Pérez
    IT Manager - Central Library
        University of Antioquia
          Medellín - Colombia
         tel: ++57(4)2105145
----------------------------------------------- -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-db-unsubscribe@lists.php.net For additional commands, e-mail: php-db-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-db-unsubscribe@lists.php.net For additional commands, e-mail: php-db-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net


« previous php.db (#10095) next »