Jump to content

ORDER BY gone wrong


Zaidejas1324

Recommended Posts

Hi i made a table which keeps player scores, but it is messed. Here's a link - http://kzlt.dev.lt/taure/rezultatai.php.  How can i fix it ?

 

The code:

 

$text .= "
<center><table border='1' width='565' height=30><tr><td width='15'>Nr.</td><td width='250'>&#381aid&#279jas</td><td width='150'><center>Ta&#353kai</center></td><td width='150'><center>Dalyvavo</center></td></tr>";
$result = mysql_query("SELECT * FROM taure_lentele ORDER BY score DESC");
while($row = mysql_fetch_array($result))
{
if($rank == 1)
{
	$color = "FF3300";
}
else if($rank == 2)
{
	$color = "FF6600";
}
else if($rank == 3)
{
	$color = "FF9900";
}
else
{
	$color = "FFCC00";
}
$text .= '<tr bgcolor="'.$color.'">
<td width="15">'.$rank++.'</td>
<td width="250"><b>'.$row['name'].'</b></td> 
<td width="150"><center>'.$row['score'].'</center></td>
<td width="150"><center>'.$row['played'].' k.</center></td>
</tr></center>';
}
$text .= "</table>";

Link to comment
https://forums.phpfreaks.com/topic/211212-order-by-gone-wrong/
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.