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
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.