MySQL query strange order results
Posted: Sat Oct 27, 2007 8:07 am
I have the following table named forum in a MySQL database......
Field Type Null Extra
ID int(11) No auto_increment
puname varchar(10) Yes
pid int(11) Yes
forum_id int(2) Yes
thread_id int(11) Yes
thread_type varchar(20) Yes
thread_title varchar(200) Yes
thread_body text Yes
thread_date bigint(20) Yes
thread_view int(11) Yes
thread_status int(2) Yes
Keyname Unique Field
ID No ID
The problem I have is when I do any query on this table ie.. SELECT * FROM forum the results do not appear how I would expect them to. I would expect the results to be listed in ascending order according to the ID field. The overall majority or the records are listed in this order but the odd one or two appear out of sequence. I have tried using ORDER by ID ASC but found I was experiencing problems.
The same problem even happens when I do a "Browse" of this table through PHPMyAdmin. I was wondering if it has something to do with the table key? I do not completely understand about index keys etc and would be grateful for any advice.
Many Thanks
Field Type Null Extra
ID int(11) No auto_increment
puname varchar(10) Yes
pid int(11) Yes
forum_id int(2) Yes
thread_id int(11) Yes
thread_type varchar(20) Yes
thread_title varchar(200) Yes
thread_body text Yes
thread_date bigint(20) Yes
thread_view int(11) Yes
thread_status int(2) Yes
Keyname Unique Field
ID No ID
The problem I have is when I do any query on this table ie.. SELECT * FROM forum the results do not appear how I would expect them to. I would expect the results to be listed in ascending order according to the ID field. The overall majority or the records are listed in this order but the odd one or two appear out of sequence. I have tried using ORDER by ID ASC but found I was experiencing problems.
The same problem even happens when I do a "Browse" of this table through PHPMyAdmin. I was wondering if it has something to do with the table key? I do not completely understand about index keys etc and would be grateful for any advice.
Many Thanks