Jump to content

Mysql not putting top users in right order


bqp2

Recommended Posts

<? 
session_start();
$query4 = "SELECT username,points FROM members WHERE won != 'yes' ORDER BY points DESC LIMIT 10"; 
$result4 = mysql_query($query4) or die(mysql_error()); 
$num=mysql_num_rows($result4);
?>

<span style="float:left;">
        <table width="200">
        <tr><td colspan="2" align="center">TOP 10 USERS</td></tr>
        <tr><td align="left"><b>Username<b></td><td align="left"><b>Points</b></td></tr>
        <?php $i=0;
        if($num>0){
while ($i < $num) {
$username6=mysql_result($result4,$i,"username");
$points6=mysql_result($result4,$i,"points");
$i++;
echo "<tr><td>".$username6."</td><td>".$points6."</td></tr>"; 
}
}
?>
</table>
</span>

 

why is it reporting like this?

 

timmy_73 - 83

shawn429 - 74

bobp - 74

bqp - 73

shelia - 44

joe23 - 219

jessica - 167

nicoleb  -153

Skippylynn - 13

shawnb75 - 11

 

the 219, 167, and 153 should be at top

Technically it's reporting them in the correct order by first number first, then second number, then third number.

 

I've tested something like this and it seems to pull mine out fine.

 

Are you sure the field you are using for points is an INT field?

 

That's the only thing I can currently think of.

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.