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

Link to comment
Share on other sites

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.

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.