m4x3vo Posted June 25, 2009 Share Posted June 25, 2009 <?php $result1 = mysql_query("SELECT * FROM users"); $num_rows2 = mysql_num_rows($result1); $num_rows3 = $num_rows2 + 1; for ($counter = 1; $counter <= $num_rows3; $counter++) { $test = mysql_query("SELECT * FROM users WHERE user_id = $counter"); while($result = mysql_fetch_array($test)) { $query2 = mysql_query("SELECT * FROM user_ach WHERE user_id = $result[user_id] "); echo "user: ", $result['username'], " - ", "num_row: ", mysql_num_rows($query2), "<br>"; } } ?> How can I order the data descending by the amount of rows there are (the last line solves for the rows). I also will need to limit the results by 10. It is a high score table with the person with the most rows at the top. Need to order and limit the data by the amount of rows it obtains in the last line. Quote Link to comment https://forums.phpfreaks.com/topic/163697-solved-another-order-by-problem/ 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.