PHP/MYSQL - "ORDER BY" Doesn't work
I have a table with a bunch of users who have a certain amount of points.
I would like to arrange the users from highest points first to the lowest.
However ORDER BY PTS DESC doesn't work.
<tr>
<th id="users_th1"><img src="<?php echo
mysql_result($r_TEAMS, $i, 'LOGO'); ?>"/> <p><?php
echo mysql_result($r_TEAMS, $i, 'NAME');
?></p></th>
<th id="users_th2">Points Value</th>
</tr>
<?php
$q_users = 'Select * from POINTS LEFT JOIN USERS on
USERS.UID = POINTS.UID where TID =
'.mysql_result($r_TEAMS, $i, 'TID');
$r_users = mysql_query($q_users, $connection) or
die(mysql_error());
$n_users = mysql_num_rows($r_users);
for($k = 0; $k <$n_users; $k++){
?>
<tr>
<td class="person"><?php echo
mysql_result($r_users, $k, 'NAME'); ?></td>
<td><?php echo mysql_result($r_users, $k,
'POINTS.PTS'); ?></td>
</tr>
<?php
}
}
No comments:
Post a Comment