Hey everyone,
I am creating a scoreboard script for a friend and he wants just to show top 10 scorers alright.
my question is how can i set foreach function to only display the top 10?
here is what the foreach i have right now
if ($val != 0) {
$query_rank = "SELECT rank FROM users WHERE callsign='$key'";
$result_rank = mysql_query($query_rank) or die("Query Failed: ".mysql_error());
while ($line = mysql_fetch_array($result_rank)) {
$rank = $line['rank'];
}
echo "<tr>";
echo " <td align='left'>$rank ".ucwords($key)."</td>";
echo " <td align='right'>".number_format($val)."</td>";
echo "</tr>";
}
}
it works right now but shows everyone that has a score which right now is like 16 people i need this to show only 10..
how can i do this?
Thank you
Smackie