Seandee Posted May 20, 2007 Share Posted May 20, 2007 Hi Guys, We have a website www.desert-rats.co.uk I am completely new to this php stuff and have found that I can pretty much get by with editing our roster.php but I have come upon a problem. I have edited the script to show the following table for updating through phpMYADMIN - www.desert-rats.co.uk/interclan.php I am not able to edit the final two parts of the code to display the info inside the columns "for" "against" and "Total" - it is over my head so am wondering if you guys could help, I only want to be able to have the info displayed under these headers, This is the code I am working with <?php $mysql_table = "cp_1v1league"; $mysql_table_b = "cp_clanleague"; require_once ("required.inc.php"); getHeader(); echo "<h2 style=\"margin-bottom: 4px;\"><center><font color=gray>=</font><font color=red>8th</font><font color=gray>=</font> <font color=red>Desert</font> <font color=white>Rats</font> <font color=blue>Batallion</font> <font color=gray>1v1 Match Leagues</font></center></h2>"; $result = MYSQL_QUERY("SELECT * FROM $mysql_table_b ORDER BY league_id") or die (mysql_error()); $rows = mysql_num_rows($result); if ($rows == "0") { echo "<strong style=\"margin-left: 21px;\">Currently, there are no leagues available.</strong>"; } if ($rows != "0") { $res = mysql_query("SELECT COUNT(*) as count FROM $mysql_table") or die(mysql_error()); list($matches) = mysql_fetch_array($res); echo "<strong style=\"margin-left: 21px;\">Total Matches</strong>"; echo "<table cellspacing=\"1\" cellpadding=\"2\" bgcolor=\"#4C4C4C\" width=\"91%\" style=\"margin-left: 21px; margin-top: 7px; margin-bottom: 10px;\"> <tr bgcolor=\"#000000\" style=\"background-image: url(img/evenrowbg.gif)\" height=\"18\"> <th style=\"padding-left: 6px; text-align: center;\">" . $matches . " <font color=gray>Match" . ($matches != 1 ? 'es' : '') . " Played To Date</font></th> </tr> </table>"; $mresults = array(); $mrows = array(); $j = 0; while ($mysql2=mysql_fetch_array($result)) { echo "<strong style=\"margin-left: 200px;\">" . checkContent($mysql2[league]) . "-" . checkContent($mysql2[division]) . " Season-" . checkContent($mysql2[season]) . "</strong>"; $mresult[$mysql2[league_id]] = MYSQL_QUERY("SELECT * FROM $mysql_table WHERE league_id='$mysql2[league_id]' ORDER BY league_id") or die (mysql_error()); $mrows[$mysql2[league_id]] = mysql_num_rows($mresult[$mysql2[league_id]]); if ($mrows[$mysql2[league_id]] == "0") { echo "<table cellspacing=\"1\" cellpadding=\"2\" bgcolor=\"#4C4C4C\" width=\"91%\" style=\"margin-left: 21px; margin-top: 7px; margin-bottom: 10px;\"> <tr bgcolor=\"#000000\"> <th style=\"padding-left: 6px; text-align: left;\">There are no matches available for this league at this time.</th> </tr> </table>"; } else { echo "<table class=\"sortable\" id=\"sortable" . ++$j . "\" cellspacing=\"1\" cellpadding=\"2\" bgcolor=\"#CCCCCC\" width=\"91%\" style=\"margin-left: 21px; margin-top: 20px; margin-bottom: 30px;\"> <tr bgcolor=\"#FFFFCC\"><th width=\"18\"> </th><th width=\"100\" style=\"padding-left: 6px;\">Clan Member</th><th width=\"30\" style=\"padding-left: 6px;\">P</th><th width=\"30\" style=\"padding-left: 6px;\">W</th><th width=\"30\" style=\"padding-left: 6px;\">D</th><th width=\"30\" style=\"padding-left: 6px;\">L</th><th width=\"30\" style=\"padding-left: 6px;\">F</th><th width=\"30\" style=\"padding-left: 6px;\">A</th><th width=\"30\" style=\"padding-left: 6px;\">Total</th></tr>\n"; $i = 1; while ($mysql=mysql_fetch_array($mresult[$mysql2[league_id]])) { $colour = $colourone; if ($i % 2) { $colour = $colourtwo; } /* echo "<p> <b>Clan Member:</b> " . checkContent($mysql) . "<br> <b>Played:</b> " . checkContent($mysql[played]) . "<br> <b>Won:</b> " . checkContent($mysql[won]) . "<br> <b>Draw:</b> " . checkContent($mysql[draw]) . "<br> <b>Lost:</b> " . checkContent($mysql[lost]) . "<br> <b>For:</b> " . checkContent($mysql[for]) . "<br> <b>Against:</b> " . checkContent($mysql[against]) . "<br>"; } if ($mysql[total] != '') { echo "<tr bgcolor=\"white\" style=\"background-image: url(img/" . ($oddeven++ % 2 ? 'even' : 'odd') . "rowbg.gif);\" height=\"14\"> <td style=\"padding-left: 6px;\"><b>Total:</b></td> <td style=\"padding-left: 9px;\">" . checkContent($mysql[total]) . "</td> </tr>"; <b>Total</b> " . checkContent($mysql[total]) . "<br>"; */ $color = ($mysql[result] == 'Win' ? '#1A8003' : ($mysql[result] == 'Loss' ? '#A10B0C' : '')); echo "<tr bgcolor=\"white\" style=\"background-image: url(img/" . ($i % 2 ? 'even' : 'odd') . "rowbg.gif);\" height=\"14\">" . "<td><span style=\"background-image: url(img/gamepics/" . urlize(checkContent($mysql[game])) . ".png); display: block; float: left; width: 18px; height: 14px; background-repeat: no-repeat; background-position: 2px 0px; \"> </span></td>" . "<td style=\"text-align: left;\">" . checkContent($mysql) . "</td>" . "<td style=\"text-align: center;\">" . checkContent($mysql[played]) . "</td>" . "<td style=\"text-align: center;\">" . checkContent($mysql[won]) . "</td>" . "<td style=\"text-align: center;\">" . checkContent($mysql[draw]) . "</td>" . "<td style=\"text-align: center;\">" . checkContent($mysql[lost]) . "</td>" . "<td style=\"text-align: center;\">" . checkContent($mysql[date]) . "</td>" . "<td style=\"text-align: center; color: $color; text-transform: uppercase; font-weight: bold;\">" . checkContent($mysql[total]) . "</td>" . "<td style=\"text-align: center;\">" . (($s = checkContent($mysql[total])) ? "<a href=\"$s\">View</a>" : " ") . "</td>" . "</tr>\n"; $i++; } echo "</table>"; } } } getFooter(); ?> Please help if you can All the best ..... Sean. Quote Link to comment https://forums.phpfreaks.com/topic/52166-code-problem/ Share on other sites More sharing options...
Seandee Posted May 20, 2007 Author Share Posted May 20, 2007 Hi Sorry the link to it is www.desert-rats.co.uk/interclan1.php Quote Link to comment https://forums.phpfreaks.com/topic/52166-code-problem/#findComment-257335 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.