Rows being placed out of order
Posted 24 May 2006 - 08:22 AM
I have a table that has column `ID` set for auto_increment and as the Primary Key. I put in 5 rows as can be seen [a href=\"http://www.lukewilkins.com/one.gif\" target=\"_blank\"]in this image[/a], and the auto_increment seems to work perfectly.
Now, I decide to delete the Address row (which is ID 3), and that goes smoothly. I now have [a href=\"http://www.lukewilkins.com/two.gif\" target=\"_blank\"]this[/a].
Then I decide to add a new row called Comment and it gives it the ID 6 (as it should). However, as you can see [a href=\"http://www.lukewilkins.com/three.gif\" target=\"_blank\"]here[/a], it places it in between ID's 2 and 4 instead of at the end of the table.
This result effects some of my later scripts and need to know how to have it just place it at the end of the table. Everything is done in php (not in phpMyAdmin). Is it something to do with the auto_increment or primary key? Any help would be greatly appreciated.
Posted 24 May 2006 - 08:46 AM
If you want the rows ordered use
SELECT * FROM fields_1 ORDER BY id
Posted 24 May 2006 - 03:25 PM
Posted 24 May 2006 - 09:57 PM
After that, floors open. I and anyone else will be MORE than happy to answer YOUR query! [Topic Solved]
Cheer up, the worst has yet to come...
Posted 24 May 2006 - 10:30 PM
Yeah, I had that same issue! That might work for urbanscribe but for me it is backwards. That places them in increasing order and I require that the be in decreasing order. So, how would I do that?
DESCending order ...
SELECT * from tablename ORDER by whatever DESC
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users