Jump to content

[SOLVED] Need simple help with a table


hewolfe

Recommended Posts

I am not much of a php programmer so please take it ez on me. I hired a guy to do a site for me and he quit half way through. I pretty much have the site up and running but I have a few items to finish. Ok I run poker tournaments and have the standings on my site through a query and printing to a table. I would like to not display the players with 0 score and I would like to number the table to show the top spot as #1 through whatever the output is. The table can be viewed here:

 

http://sportsbarpokertour.com/pages/printscores.php

 

This is the code:

 

$query = 'SELECT `name`,`score`,`wins`,`number` FROM `users` ORDER BY `score` DESC ';

$rt=mysql_query($query);

 

?>

</p>

  <table  width="421" border="1" cellpadding="0" cellspacing="0" bordercolor="#736f6e">

  <tr align="left">

 

    <td width="32%"><div align="Center"><font size="+1">Player</font></div></td>

    <td width="22%"><div align="center"><font size="+1">Points</font></div></td>

    <td width="22%"><div align="center"><font size="+1">Wins</font></div></td>

    <td width="22%"><div align="center"><font size="+1">Played</font></div></td>

  </tr><?

while($nt=mysql_fetch_array($rt)){

echo "<tr><td><font size='2'><left>$nt[name]</font></left></td><td><font size='2'><center>$nt[score]</font></center></td><td><font size='2'><center>$nt[wins]</font></center></td> <td><font size='2'><center>$nt[number]</font></center></td>

</tr>";

}

echo mysql_error();

exit();

?>

</table>

<p> </p>

<p> </p>

<p> </p>

 

Any help would be appreciated.

Link to comment
https://forums.phpfreaks.com/topic/43194-solved-need-simple-help-with-a-table/
Share on other sites

here you go, hopefully it works. :)

 

$query = 'SELECT `name`,`score`,`wins`,`number` FROM `users` WHERE `score`>'0' ORDER BY `score` DESC ';
$rt=mysql_query($query);

?>
</p>
  <table  width="421" border="1" cellpadding="0" cellspacing="0" bordercolor="#736f6e">
  <tr align="left">
     <td width="2%"><div align="Center"><font size="+1">Rank</font></div></td>
    <td width="32%"><div align="Center"><font size="+1">Player</font></div></td>
    <td width="22%"><div align="center"><font size="+1">Points</font></div></td>
    <td width="22%"><div align="center"><font size="+1">Wins</font></div></td>
    <td width="22%"><div align="center"><font size="+1">Played</font></div></td>
  </tr><?
$rank = 1;
while($nt=mysql_fetch_array($rt)){
echo "<tr><td>#{$rank}<td><font size='2'><left>{$nt['name']}</font></left></td><td><font size='2'><center>{$nt['score']}</font></center></td><td><font size='2'><center>{$nt['wins']}</font></center></td><td><font size='2'><center>{$nt['number']}</font></center></td>
</tr>";
$rank++;
}
echo mysql_error();
exit();
?>
</table>
<p> </p>
<p> </p>
<p> </p>

Thank you for the help but I get this error:

 

Parse error: parse error, unexpected T_LNUMBER in /home/harley55/public_html/sportsbarpokertour/pages/printscores.php on line 48

 

this is line 48:

 

$query = 'SELECT `name`,`score`,`wins`,`number` FROM `users` WHERE `score`>'0' ORDER BY `score` DESC ';

 

Any suggestions

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.