List:General Discussion« Previous MessageNext Message »
From:Paul DuBois Date:February 13 2003 9:23pm
Subject:Re: Strange sorting in table
View as plain text  
At 19:55 +0100 2/13/03, Viktor Vasiliou wrote:
>Hi Stefan,
>Thanks for your reply!
>The table has just been created, and has therefore no deleted 
>entries. ID 1-1000 was created by myself, ID 1002 was created when a 
>new user registered at the website. ID 1001, 1003, 1004, etc is 
>sorted correctly.
>There is three tables in the database which all get a new row when a 
>user signup. First, an entry is created in "tblmembers" (using 
>auto_increment). After that, an entry is created in two other tables 
>(using mysql_insert_id to set the right ID in the primary key 
>Any idea?

The information you provide here doesn't really address Stefan's suggestion
at all.  Are you retrieving the values using a SELECT statement that
include an ORDER BY ID clause?  If not, add one and see if that solves
the problem.  If you are, then is your AUTO_INCREMENT column an integer
column (not a CHAR or VARCHAR or something other than integer)?  If it
is an integer column, then let's see the structure of your table.

>Viktor Vasiliou
>----- Original Message -----
>From: Stefan Hinz
>To: Viktor Vasiliou
>Cc: mysql@stripped
>Sent: Wednesday, February 12, 2003 3:34 PM
>Subject: Re: Strange sorting in table
>>  I have a couple of tables in a MySQL database. In one of the tables,
>>  PhpMyAdmin sorts very strange. ID 1002 is places between ID 21 and
>>  ID 22. Any idea why?
>Have a look at the table structure. You will find 'ID' is an
>AUTO_INCREMENT column. When entries are deleted, they leave "gaps".
>These gaps are filled with records newly entered. So what you see is
>the physical order. If you want another sort order, you could issue
>"... ORDER BY ID".
>   Stefan Hinz <hinz@stripped>
>   iConnect GmbH <>
>   Heesestr. 6, 12169 Berlin (Germany)
>   Telefon: +49 30 7970948-0  Fax: +49 30 7970948-3

Strange sorting in tableViktor Vasiliou12 Feb
  • Re: Strange sorting in tableStefan Hinz12 Feb
  • Re: Strange sorting in tableViktor Vasiliou13 Feb
    • Re[2]: Strange sorting in tableStefan Hinz13 Feb
    • Re: Strange sorting in tablePaul DuBois13 Feb
  • Re: Strange sorting in tableViktor Vasiliou13 Feb