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! Quote 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"; Quote 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. Quote Link to comment https://forums.phpfreaks.com/topic/188880-sort-help/#findComment-997253 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.