seany123 Posted April 3, 2009 Share Posted April 3, 2009 okay i currently have this code: table width="54%" border="0" align="left"> <tr> <th width="8%"> <th width="14%">Rank <th width="26%"><b>Username</b> </td> <th width="16%"><strong>Level</strong> <th width="20%"><strong>Money</strong> <th width="16%">Status</tr> <?php //Select all members ordered by level (highest first, members table also doubles as rankings table) $query = $db->execute("select `id`, `username`, `level`, `money`, `last_active` from `players` order by `level` desc limit 50"); while($member = $query->fetchrow()) { echo "<td>"; echo "<td>" . number_format($i++) . "</td>\n"; echo "<td><a href=\"profile.php?id=" . $member['username'] . "\">"; echo $member['username']; echo "<td>" . number_format($member['level']) . "</td>\n"; echo "<td>$" . number_format($member['money']) . "</td>\n"; if ($member['last_active'] >= Time()-1200) { echo "<td><font color=\"lime\">Online</font></td>"; } else { echo "<td><font color=\"red\">Offline</font></td>"; } echo "</tr>\n"; } ?> </table> i want to change the $username bit so it has this... heres the code i want added... <?php if ($member['banned'] == 1) { echo "<b>[b] </b>"; echo "<STRIKE>" .$member['username']. "</STRIKE>"; } else if ($member['ncolor'] == 1) { echo "<font color=\"blue\">".$member['username']."</font>"; } else if($member['ncolor'] == 2) { echo "<font color=\"green\">".$member['username']."</font>"; } else if($member['ncolor'] == 3) { echo "<font color=\"yellow\">".$member['username']."</font>"; } else if($member['ncolor'] == 4) { echo "<font color=\"pink\">".$member['username']."</font>"; } else if($member['ncolor'] == 5) { echo "<font color=\"silver\">".$member['username']."</font>"; } else if($member['staff'] >= 1) { echo "<font color=\"gold\">".$member['username']."</font>"; } else if($member['rm'] >= 1) { echo "<font color=\"red\">".$member['username']."</font>"; } else { echo "<font color=\"\">".$member['username']."</font>"; } ?> but everytime i try and put it in i just get a white page... please help me out if you can!! Quote Link to comment https://forums.phpfreaks.com/topic/152357-solved-help-with-tables/ Share on other sites More sharing options...
taquitosensei Posted April 3, 2009 Share Posted April 3, 2009 put this at the top of your script. ini_set("display_errors","2"); ERROR_REPORTING(E_ALL); that will turn on error reporting. Telling you where the error. Usually a white screen means you have an error and error reporting is off. Quote Link to comment https://forums.phpfreaks.com/topic/152357-solved-help-with-tables/#findComment-800208 Share on other sites More sharing options...
seany123 Posted April 3, 2009 Author Share Posted April 3, 2009 thankyou for your reply. i have however already tried that and still got white page. Quote Link to comment https://forums.phpfreaks.com/topic/152357-solved-help-with-tables/#findComment-800270 Share on other sites More sharing options...
seany123 Posted April 3, 2009 Author Share Posted April 3, 2009 can anyone see anything wrong with this these lines... echo "<font color=\"blue\">".$member['username']."</font>"; Quote Link to comment https://forums.phpfreaks.com/topic/152357-solved-help-with-tables/#findComment-800287 Share on other sites More sharing options...
ober Posted April 3, 2009 Share Posted April 3, 2009 Show us how you combined the code. Otherwise we have no idea how the code flows. Quote Link to comment https://forums.phpfreaks.com/topic/152357-solved-help-with-tables/#findComment-800289 Share on other sites More sharing options...
ober Posted April 3, 2009 Share Posted April 3, 2009 can anyone see anything wrong with this these lines... echo "<font color=\"blue\">".$member['username']."</font>"; There is nothing wrong with those lines other than the fact that you are using very old styling methods. Quote Link to comment https://forums.phpfreaks.com/topic/152357-solved-help-with-tables/#findComment-800291 Share on other sites More sharing options...
seany123 Posted April 3, 2009 Author Share Posted April 3, 2009 firstly i would like to apologise for my code not being very clean... <?php include("lib.php"); define("PAGENAME", "Hall Of Fame"); $player = check_user($secret_key, $db); $i = 1; include("templates/private_header.php"); ?> <style type="text/css"> <!-- body, td, th { color: #FFFFFF; } body { background-color: #000000; } a:link { color: #FF0000; } a:visited { color: #FF0000; } a:hover { color: #666666; } a:active { color: #FF0000; } .style5 {color: #FFFFFF} --> </style> <table width="650" border="1" cellpadding="0" cellspacing="0" bordercolor="#FF0000"> <tr> <td align="center" class="style5"><strong>Hall Of Fame </strong></td> </tr> </table> <table width="660" border="0"> <tr> <td width="90"><div align="center"><a href="levelhof.php">Level</a></div></td> <td width="90"><div align="center"><a href="moneyhof.php">Money</a></div></td> <td width="90"><div align="center"><a href="bankhof.php">Bank</a></div></td> <td width="90"><div align="center"><a href="pointshof.php">Points</a></div></td> <td width="90"><div align="center"><a href="strengthhof.php">Strength</a></div></td> <td width="90"><div align="center"><a href="defencehof.php">Defence</a></div></td> <td width="90"><div align="center"><a href="speedhof.php">Speed</a></div></td> </tr> </table> <br> <table width="54%" border="0" align="left"> <tr> <th width="8%"> <th width="14%">Rank <th width="26%"><b>Username</b> </td> <th width="16%"><strong>Level</strong> <th width="20%"><strong>Money</strong> <th width="16%">Status</tr> <?php //Select all members ordered by level (highest first, members table also doubles as rankings table) $query = $db->execute("select `id`, `username`, `level`, `money`, `last_active`, `banned`, `staff`, `rm`, `ncolor` from `players` order by `level` desc limit 50"); while($member = $query->fetchrow()) { echo "<td>"; echo "<td>" . number_format($i++) . "</td>\n"; echo "<td><a href=\"profile.php?id=" . $member['username'] . "\">"; <?php if ($member['banned'] == 1) { echo "<td><b>[b] </b>"; echo "<STRIKE>" .$member['username']. "</STRIKE></td>"; } else if ($member['ncolor'] == 1) { echo "<td><font color=\"blue\">".$member['username']."</font></td>"; } else if($member['ncolor'] == 2) { echo "<td><font color=\"green\">".$member['username']."</font></td>"; } else if($member['ncolor'] == 3) { echo "<td><font color=\"yellow\">".$member['username']."</font></td>"; } else if($member['ncolor'] == 4) { echo "<td><font color=\"pink\">".$member['username']."</font></td>"; } else if($member['ncolor'] == 5) { echo "<td><font color=\"silver\">".$member['username']."</font></td>"; } else if($member['staff'] >= 1) { echo "<td><font color=\"gold\">".$member['username']."</font></td>"; } else if($member['rm'] >= 1) { echo "<td><font color=\"red\">".$member['username']."</font></td>"; } else { echo "<td><font color=\"\">".$member['username']."</font></td>"; } echo "<td>" . number_format($member['level']) . "</td>\n"; echo "<td>$" . number_format($member['money']) . "</td>\n"; if ($member['last_active'] >= Time()-1200) { echo "<td><font color=\"lime\">Online</font></td>"; } else { echo "<td><font color=\"red\">Offline</font></td>"; } echo "</tr>\n"; } ?> </table> <div align="center"> </div> Quote Link to comment https://forums.phpfreaks.com/topic/152357-solved-help-with-tables/#findComment-800293 Share on other sites More sharing options...
seany123 Posted April 3, 2009 Author Share Posted April 3, 2009 i just debugged the code a little and now its no longer a white page however the tables arnt lining up anymore. <?php include("lib.php"); define("PAGENAME", "Hall Of Fame"); $player = check_user($secret_key, $db); $i = 1; include("templates/private_header.php"); ?> <style type="text/css"> <!-- body, td, th { color: #FFFFFF; } body { background-color: #000000; } a:link { color: #FF0000; } a:visited { color: #FF0000; } a:hover { color: #666666; } a:active { color: #FF0000; } .style5 {color: #FFFFFF} --> </style> <table width="650" border="1" cellpadding="0" cellspacing="0" bordercolor="#FF0000"> <tr> <td align="center" class="style5"><strong>Hall Of Fame </strong></td> </tr> </table> <table width="660" border="0"> <tr> <td width="90"><div align="center"><a href="levelhof.php">Level</a></div></td> <td width="90"><div align="center"><a href="moneyhof.php">Money</a></div></td> <td width="90"><div align="center"><a href="bankhof.php">Bank</a></div></td> <td width="90"><div align="center"><a href="pointshof.php">Points</a></div></td> <td width="90"><div align="center"><a href="strengthhof.php">Strength</a></div></td> <td width="90"><div align="center"><a href="defencehof.php">Defence</a></div></td> <td width="90"><div align="center"><a href="speedhof.php">Speed</a></div></td> </tr> </table> <br> <table width="54%" border="0" align="left"> <tr> <th width="8%"> <th width="14%">Rank <th width="26%"><b>Username</b> </td> <th width="16%"><strong>Level</strong> <th width="20%"><strong>Money</strong> <th width="16%">Status</tr> <?php //Select all members ordered by level (highest first, members table also doubles as rankings table) $query = $db->execute("select `id`, `username`, `level`, `money`, `last_active`, `banned`, `staff`, `rm`, `ncolor` from `players` order by `level` desc limit 50"); while($member = $query->fetchrow()) { echo "<td>"; echo "<td>" . number_format($i++) . "</td>\n"; echo "<td><a href=\"profile.php?id=" . $member['username'] . "\">"; if ($member['banned'] == 1) { echo "<td><b>[b] </b>"; echo "<STRIKE>" .$member['username']. "</STRIKE></td>"; } else if ($member['ncolor'] == 1) { echo "<td><font color=\"blue\">".$member['username']."</font></td>"; } else if($member['ncolor'] == 2) { echo "<td><font color=\"green\">".$member['username']."</font></td>"; } else if($member['ncolor'] == 3) { echo "<td><font color=\"yellow\">".$member['username']."</font></td>"; } else if($member['ncolor'] == 4) { echo "<td><font color=\"pink\">".$member['username']."</font></td>"; } else if($member['ncolor'] == 5) { echo "<td><font color=\"silver\">".$member['username']."</font></td>"; } else if($member['staff'] >= 1) { echo "<td><font color=\"gold\">".$member['username']."</font></td>"; } else if($member['rm'] >= 1) { echo "<td><font color=\"red\">".$member['username']."</font></td>"; } else { echo "<td><font color=\"\">".$member['username']."</font></td>"; } echo "<td>" . number_format($member['level']) . "</td>\n"; echo "<td>$" . number_format($member['money']) . "</td>\n"; if ($member['last_active'] >= Time()-1200) { echo "<td><font color=\"lime\">Online</font></td>"; } else { echo "<td><font color=\"red\">Offline</font></td>"; } echo "</tr>\n"; } ?> </table> <div align="center"> </div> Quote Link to comment https://forums.phpfreaks.com/topic/152357-solved-help-with-tables/#findComment-800307 Share on other sites More sharing options...
seany123 Posted April 3, 2009 Author Share Posted April 3, 2009 it looks like its all been fixed... i think it was basically due to me being lazy and i apologise for that. Quote Link to comment https://forums.phpfreaks.com/topic/152357-solved-help-with-tables/#findComment-800312 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.