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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.