Hi
I need some help. The While loop below returns and displays exactly what i want but i want to sort the rows by $row['no_referrals'] showing the largest first. Has anyone any ideas how i do this???
$sql = mysql_query("SELECT * FROM tblmembers WHERE referred_by='$member_id'") or
die(mysql_error());
//$num_rows = mysql_num_rows($sql_num_rows);
//now you could do something like this to make sure that you don't loop
//through the results if there aren't any to be looped through
if (mysql_num_rows($sql) < 1) {
die("There are not matching results");
}
//now we loop through the results..
//for ( $counter = 0; $counter <= $num_rows ; $counter += 1) {
while($row = mysql_fetch_array($sql)) {
echo '<tr bgcolor="#FFFFCC">
<td align="center" width="160" height="20" bgcolor="#eeeeee">
<div align="center" class="style5">';
echo $row['firstname'];
echo ' ' ;
echo $row['lastname'];
echo '<div>
</td>
<td width="160" height="20" bgcolor="#eeeeee">
<div align="center" class="style5"> ';
echo $row['no_referrals'];
echo '</div>
</td>
<td width="160" height="20" bgcolor="#FFFFCC" scope="row">
<div align="center" class="style5"> ';
echo '<a href="mailto:';
echo $row['email'];
echo '">';
echo $row['email'];
echo '</a>';
echo '</div>
</td>
</tr> ';
}