garyed Posted June 13, 2011 Share Posted June 13, 2011 I have a table with a bunch of records that each have a unique id number as one of the fields. Since I added things hap-hazardly they are all over the place order wise. Is there a command to update or alter the table where the records could be moved so that they go from lowest to highest using the id number? Link to comment https://forums.phpfreaks.com/topic/239269-change-oder-of-records-in-table/ Share on other sites More sharing options...
fugix Posted June 13, 2011 Share Posted June 13, 2011 you would want to use the ALTER TABLE clause, use as follows. $query = mysql_query("ALTER TABLE table_name ORDER BY id DESC|ASC"); for further syntax examples visit http://dev.mysql.com/doc/refman/5.1/en/alter-table.html Link to comment https://forums.phpfreaks.com/topic/239269-change-oder-of-records-in-table/#findComment-1229227 Share on other sites More sharing options...
garyed Posted June 13, 2011 Author Share Posted June 13, 2011 Thanks, thats exactly what I needed. I also just found the answer using phpmyadmin too. Link to comment https://forums.phpfreaks.com/topic/239269-change-oder-of-records-in-table/#findComment-1229233 Share on other sites More sharing options...
fugix Posted June 13, 2011 Share Posted June 13, 2011 glad i could help, please mark this thread as solved, lower left hand of page. Link to comment https://forums.phpfreaks.com/topic/239269-change-oder-of-records-in-table/#findComment-1229241 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.