slj90 Posted January 18, 2010 Share Posted January 18, 2010 I have a page that displays data from a table, however I want to be able to sort it in order of price (hi > lo) and (lo > hi).. how would i do this? is it a query ? The price field is called 'Price' The query i'm using at the moment to display the data is $query = "SELECT * FROM Product WHERE ProductC = 'Beer' "; Thanks for your help! Link to comment https://forums.phpfreaks.com/topic/188880-sort-help/ Share on other sites More sharing options...
Buddski Posted January 18, 2010 Share Posted January 18, 2010 $query = "SELECT * FROM Product WHERE ProductC = 'Beer' ORDER BY Price ASC"; or $query = "SELECT * FROM Product WHERE ProductC = 'Beer' ORDER BY Price DESC"; Link to comment https://forums.phpfreaks.com/topic/188880-sort-help/#findComment-997252 Share on other sites More sharing options...
oni-kun Posted January 18, 2010 Share Posted January 18, 2010 ASC and DESC would help, I 'think' this is correct: SELECT * FROM Product WHERE `ProductC` = 'Beer' ORDER BY Price DESC EDIT: Beat to it. Link to comment https://forums.phpfreaks.com/topic/188880-sort-help/#findComment-997253 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.