nithan Posted December 23, 2011 Share Posted December 23, 2011 Hello, I have a code which displays name and number. It is working now but I want to sort the content on the basis of number... The code is given below: while($rows = mysql_fetch_array($results)){ echo "". $rows['username'] ." ". $rows['COUNT(Completed_Sales)'] .""; echo "<br />"; } The result will look like this Name Prdoducts. Quote Link to comment https://forums.phpfreaks.com/topic/253739-how-to-sort/ Share on other sites More sharing options...
trq Posted December 23, 2011 Share Posted December 23, 2011 You do your sorting in your query. This has nothing to do with php. SELECT fld FROM tbl ORDER BY some_fld; Quote Link to comment https://forums.phpfreaks.com/topic/253739-how-to-sort/#findComment-1300823 Share on other sites More sharing options...
nithan Posted December 30, 2011 Author Share Posted December 30, 2011 Wow... Thanks a lot.. It worked for me...... You rock man.. Quote Link to comment https://forums.phpfreaks.com/topic/253739-how-to-sort/#findComment-1302503 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.