Unholy Prayer Posted November 26, 2006 Share Posted November 26, 2006 This is probably a noob question, but how do I change the order that table fields are displayed in?This is my query:[code]$result = mysql_query("select * from news order by id limit 5");[/code]Instead of displaying the news from the first news posted to the most recent news posted, I want the most recent news posted displayed first. Link to comment https://forums.phpfreaks.com/topic/28568-displaying-sql-tables/ Share on other sites More sharing options...
fert Posted November 26, 2006 Share Posted November 26, 2006 DESC Link to comment https://forums.phpfreaks.com/topic/28568-displaying-sql-tables/#findComment-130707 Share on other sites More sharing options...
Unholy Prayer Posted November 26, 2006 Author Share Posted November 26, 2006 So just add "DESC" to the end of the query? Link to comment https://forums.phpfreaks.com/topic/28568-displaying-sql-tables/#findComment-130708 Share on other sites More sharing options...
fert Posted November 26, 2006 Share Posted November 26, 2006 [code]SELECT * FROM `news` ORDER BY `id` DESC LIMIT 5[/code] Link to comment https://forums.phpfreaks.com/topic/28568-displaying-sql-tables/#findComment-130711 Share on other sites More sharing options...
Unholy Prayer Posted November 26, 2006 Author Share Posted November 26, 2006 Ahhh, thank you. Link to comment https://forums.phpfreaks.com/topic/28568-displaying-sql-tables/#findComment-130712 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.