Jump to content

keefedog

New Members
  • Posts

    1
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

keefedog's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Hi, Relatively new to php / mysql and need some help with generating standings from a football schedule. I have a 'schedules' table in a mysql database with 'vteam', 'vscore', 'hteam', 'hscore' among the columns. I have it so users login and input scores which get posted to my website but would also like this process to update standings as well. I've pieced together some code to generate the standings page. I've managed to generate each team's away W-L records so far but the problem is trying to do the same for home records and keeping the info on the same line of the html table as the relevant team. I've been playing with the UNION idea for some time now and can't get it working right. Any help would be awesome. Thanks in advance. Below is the relevant code which is working for the away records: php: -------------------------------------------------------------------------------- echo "<table align=center width=530 cellpadding=1 cellspacing=0 border=0>"; echo "<tr><td colspan=9><b>2005 Standings</b></td></tr>"; echo "<tr><td>Team</td><td>GP</td><td>W</td><td>L</td><td>Home</td><td>Road</td><td>F</td><td>A</td><td>Pts</td></tr>"; $sqlquery = '(SELECT vteam AS team,SUM(IF(vscore > hscore, 1, 0)) AS vwins, SUM(IF(hscore > vscore, 1, 0)) AS vlosses FROM schedules GROUP BY team)'; $result = mysql_query($sqlquery); while($row = mysql_fetch_array($result)) { echo "<tr><td>$row[team]</td><td></td><td></td><td></td><td></td><td>$row[vwins]-$row[vlosses]</td><td></td><td></td><td></td></td>"; } mysql_free_result($result); echo "</table>"; ?> --------------------------------------------------------------------------------
×
×
  • 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.