PugJr Posted April 14, 2009 Share Posted April 14, 2009 Like for instance I have 3 rows like this: ID var 3 6 4 8 5 3 How would I select the third row and put it as the first one, then making the first row become second, and second become third or some mysql order through PHP that can just move a row from one place to another. Thanks. Link to comment https://forums.phpfreaks.com/topic/153944-how-to-arrange-a-mysql-database-with-php/ Share on other sites More sharing options...
Kieran Menor Posted April 14, 2009 Share Posted April 14, 2009 Isn't this just a matter of doing something like: SELECT * FROM `table` ORDER BY `var` Link to comment https://forums.phpfreaks.com/topic/153944-how-to-arrange-a-mysql-database-with-php/#findComment-809098 Share on other sites More sharing options...
Maq Posted April 14, 2009 Share Posted April 14, 2009 How would I select the third row and put it as the first one, then making the first row become second, and second become third or some mysql order through PHP that can just move a row from one place to another. Are you referring to actually ALTERing the MySQL table? Which is a bad idea, and most likely due to poor design. Or display it in the order you described, which I like to call, reverse, or DESCending. Link to comment https://forums.phpfreaks.com/topic/153944-how-to-arrange-a-mysql-database-with-php/#findComment-809099 Share on other sites More sharing options...
PugJr Posted April 14, 2009 Author Share Posted April 14, 2009 Yeah...I was referring to actually altering the table, but what you mention would work as well. How would you do that reverse or descending when reading a table or whatever it does. Thank you! Link to comment https://forums.phpfreaks.com/topic/153944-how-to-arrange-a-mysql-database-with-php/#findComment-809111 Share on other sites More sharing options...
Maq Posted April 14, 2009 Share Posted April 14, 2009 If you just want to display the table in descending order by id do something like: SELECT * FROM table ORDER BY id DESC Link to comment https://forums.phpfreaks.com/topic/153944-how-to-arrange-a-mysql-database-with-php/#findComment-809112 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.