hewolfe Posted March 18, 2007 Share Posted March 18, 2007 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 More sharing options...
hewolfe Posted March 18, 2007 Author Share Posted March 18, 2007 here is my server and php info: PHP Version 4.3.11 Linux svr79.ehostpros.com 2.4.21-27.0.2.ELsmp #1 SMP Wed Jan 12 23:35:44 EST 2005 i686 Link to comment https://forums.phpfreaks.com/topic/43194-solved-need-simple-help-with-a-table/#findComment-209737 Share on other sites More sharing options...
JasonLewis Posted March 18, 2007 Share Posted March 18, 2007 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> Link to comment https://forums.phpfreaks.com/topic/43194-solved-need-simple-help-with-a-table/#findComment-209739 Share on other sites More sharing options...
hewolfe Posted March 18, 2007 Author Share Posted March 18, 2007 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 Link to comment https://forums.phpfreaks.com/topic/43194-solved-need-simple-help-with-a-table/#findComment-209740 Share on other sites More sharing options...
hewolfe Posted March 18, 2007 Author Share Posted March 18, 2007 Got it. Thank you so much. I took out '0' and just used 0 and it works fine. Link to comment https://forums.phpfreaks.com/topic/43194-solved-need-simple-help-with-a-table/#findComment-209742 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.