Jump to content

Need Help With ORDER by total score


affc

Recommended Posts

Hope someone can help,

How will I be able to set the ORDER by the score that is generated? At the moment I got it going by win draw loss, I just simply want to order it by $score but generates an error at the moment,

 

<? 
// Retrieve data from database  
$sql="SELECT * FROM $tbl_name ORDER BY Help here plz win DESC, draw DESC, loss ASC"; 
$result=mysql_query($sql); 

$RankLadder = 0; 
// Start looping rows in mysql database. 
while($rows=mysql_fetch_array($result)){ 
$score = $rows['win'] - $rows['loss']; 
?> 
                      <tr align="center" valign="middle">  
                        <td width="20" height="22" background="line.gif"> <div align="center"><font color="#000000" size="2"><?php echo ++$RankLadder ?></font></div></td> 
                        <td width="100" height="22" background="line.gif"><font color="#000000" size="2"><? echo $rows['member']; ?></font></td> 
                        <td width="50" height="22" background="line.gif"> <div align="center"><font color="#000000" size="2"><? echo $rows['win']; ?></font></div></td> 
                        <td width="50" height="22" background="line.gif"> <div align="center"><font color="#000000" size="2"><? echo $rows['draw']; ?></font></div></td> 
                        <td width="50" height="22" background="line.gif"> <div align="center"><font color="#000000" size="2"><? echo $rows['loss']; ?></font></div></td> 
                        <td width="60" height="22" background="line.gif"> 
<div align="center"><font color="#000000" size="2"><? echo $score ?></font></div></td> 
                      </tr> 
                      <? 
} 
mysql_close(); 
?> 

Link to comment
https://forums.phpfreaks.com/topic/96112-need-help-with-order-by-total-score/
Share on other sites

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.