Jump to content

[SOLVED] another order by problem :(


m4x3vo

Recommended Posts

<?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.

Link to comment
https://forums.phpfreaks.com/topic/163697-solved-another-order-by-problem/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.