Conference I

"; ?>
"; if ($row['divisionName'] == "C") echo "

     Conference II

"; echo ""; $prevDiv = $row['divisionName']; } $teamid = $row['teamid']; $gameResults = mysql_query("select count(*),'Wins' as type from game where playoff=0 AND ((playerHome=$teamid AND scoreHome>ScoreAway) OR (playerAway=$teamid AND scoreAway>scoreHome)) UNION select count(*), 'Ties' as type from game where playoff=0 AND ((playerHome=$teamid OR playerAway=$teamid) AND scoreHome=scoreAway) UNION select count(*), 'Loss' as type from game where playoff=0 and ((playerHome=$teamid AND scoreHome"; mysql_query("UPDATE users_teams SET points=$pts WHERE team=$teamid;") or die (mysql_error()); } $goalsScored = mysql_query("select sum(scoreHome) as gf, sum(scoreAway) as ga from game where playerHome=$teamid union select sum(scoreAway) as gf, sum(scoreHome) as ga from game where playerAway=$teamid;"); $goalsFor = 0; $goalsAgainst = 0; while($res = mysql_fetch_assoc($goalsScored)) { $goalsFor += $res['gf']; $goalsAgainst += $res['ga']; } echo ""; } echo "
Division: ".$row['divisionName']." MP W D L GF GA Pts
".$row['name']." - (".$row['nickname'].") $played ".$teamResults['Wins']." ".$teamResults['Ties']." ".$teamResults['Loss']." $goalsFor $goalsAgainst $pts
"; mysql_free_result($divisions); echo "

Overall Standings

* = Playoff Team
"; $standings = mysql_query("SELECT teams.name,users.nickname,teams.id,points,users_teams.inPlayoffs FROM users_teams inner join teams on (teams.id=users_teams.team) INNER JOIN users on (users.id=users_teams.user) order by users_teams.points desc,teams.name;"); echo ""; $i = 1; $prev = ""; while ($row = mysql_fetch_assoc($standings)) { if ($i%2==0) $bg = "bgcolor='#dddddd'"; else $bg = ""; if ($row['points'] != $prev) $rank = $i; else $rank = " "; $prev = $row['points']; $name = $row['name']; if ($row['inPlayoffs'] == '1') $name = "*".$row['name'].""; echo ""; $i++; } echo "
RankTeamPoints
$rank$name (".$row['nickname'].")".$row['points']."
"; ?>