// TJHL ONLY // connect to database include 'dbc.php'; include 'gt.php'; $i = -1; print "
"; $query_team = "SELECT * FROM Teams WHERE Level = 1 AND Defunct = 0"; $result_team = mysql_query ($query_team, $connection); while ($row_team = mysql_fetch_array($result_team)){ $TeamNum = $row_team["TeamNum"]; $Top10Checker = 0; if ($SeasonType == 'PlayOff'){ $qstand = "SELECT * FROM TeamStandings WHERE Level = 1 AND Team = $TeamNum AND Season = $SeasonNumber AND Type = '$SeasonType' "; $Squery = mysql_query($qstand,$connection); $qstand2 = @mysql_fetch_array($Squery); if ($qstand2["GP"] > 0){ } else { $Top10Checker = 1; } } if ($Top10Checker == 1){ } else { // line 1 $i++; $TeamName[$i] = $row_team["City"]; $LinePoints[$i] = 0; $LinePointsCheck[$i] = 0; $LineNames[$i] = " "; $LinePID[$i] = " "; $LinePointsCheck2[$i] = 0; $LineGoals[$i] = 0; $LineGoalsCheck[$i] = 0; $LinePlus[$i] = 0; $LinePlusCheck[$i] = 0; $LineShots[$i] = 0; $LineChecks[$i] = 0; $LineAvoid[$i] = 0; $query_c1 = "SELECT PlayerID FROM GameRoster WHERE Spot = 'D1' AND Team = $TeamNum"; $result_c1 = mysql_query ($query_c1, $connection); while ($row_c1 = mysql_fetch_array($result_c1)){ $PID = $row_c1["PlayerID"]; $LinePID[$i] = $PID; $LinePID2[$i] = $PID; $query_player = "SELECT LastName FROM Players WHERE PlayerID = $PID"; $result_player = mysql_query ($query_player, $connection); if(!$result_player){ die ("Could not query the database: ".mysql_error()); } while ($row_player = mysql_fetch_array($result_player)){ $LineNames[$i] = $LineNames[$i] . $row_player["LastName"] . '-'; $LineNames2[$i] = $LineNames2[$i] . $row_player["LastName"] . '-'; } $query_stats = "SELECT * FROM PlayerStats WHERE Season = $SeasonNumber AND Type = '$SeasonType' AND Level = 1 AND PlayerID = $PID"; $result_stats = mysql_query ($query_stats, $connection); while ($row_stats = mysql_fetch_array ($result_stats)){ $LinePoints[$i] = $LinePoints[$i] + $row_stats["Pts"]; $LineGoals[$i] = $LineGoals[$i] + $row_stats["G"]; $LinePlus[$i] = $LinePlus[$i] + $row_stats["PlsMns"]; $LineShots[$i] = $LineShots[$i] + $row_stats["Shots"]; $LineChecks[$i] = $LineChecks[$i] + $row_stats["CheckGiven"]; $LineAvoid[$i] = $LineAvoid[$i] + $row_stats["CheckAvoided"]; } } $query_rw1 = "SELECT PlayerID FROM GameRoster WHERE Spot = 'D2' AND Team = $TeamNum"; $result_rw1 = mysql_query ($query_rw1, $connection); if(!$result_rw1){ die ("Could not query the database: ".mysql_error()); } while ($row_rw1 = mysql_fetch_array($result_rw1)){ $PID = $row_rw1["PlayerID"]; $query_player = "SELECT * FROM Players WHERE PlayerID = $PID"; $result_player = mysql_query ($query_player, $connection); if(!$result_player){ die ("Could not query the database: ".mysql_error()); } while ($row_player = mysql_fetch_array($result_player)){ $LineNames[$i] = $LineNames[$i] . $row_player["LastName"]; } $query_stats = "SELECT * FROM PlayerStats WHERE Season = $SeasonNumber AND Type = '$SeasonType' AND Level = 1 AND PlayerID = $PID"; $result_stats = mysql_query ($query_stats, $connection); while ($row_stats = mysql_fetch_array ($result_stats)){ $LinePoints[$i] = $LinePoints[$i] + $row_stats["Pts"]; $LineGoals[$i] = $LineGoals[$i] + $row_stats["G"]; $LinePlus[$i] = $LinePlus[$i] + $row_stats["PlsMns"]; $LineShots[$i] = $LineShots[$i] + $row_stats["Shots"]; $LineChecks[$i] = $LineChecks[$i] + $row_stats["CheckGiven"]; $LineAvoid[$i] = $LineAvoid[$i] + $row_stats["CheckAvoided"]; } } $LinePointsCheck[$i] = $LinePoints[$i]; $LinePointsCheck2[$i] = $LinePoints[$i]; $LineGoalsCheck[$i] = $LineGoals[$i]; $LineGoalsCheck2[$i] = $LineGoals[$i]; $LinePlusCheck[$i] = $LinePlus[$i]; $LinePlusCheck2[$i] = $LinePlus[$i]; $LineShotsCheck[$i] = $LineShots[$i]; $LineShotsCheck2[$i] = $LineShots[$i]; $LineChecksCheck[$i] = $LineChecks[$i]; $LineChecksCheck2[$i] = $LineChecks[$i]; $LineAvoidCheck[$i] = $LineAvoid[$i]; $LineAvoidCheck2[$i] = $LineAvoid[$i]; // line 2 $i++; $TeamName[$i] = $row_team["City"]; $LinePoints[$i] = 0; $LinePointsCheck[$i] = 0; $LineNames[$i] = " "; $LinePointsCheck2[$i] = 0; $LineGoals[$i] = 0; $LineGoalsCheck[$i] = 0; $LinePlus[$i] = 0; $LinePlusCheck[$i] = 0; $LineShots[$i] = 0; $LineChecks[$i] = 0; $LineAvoid[$i] = 0; $query_c1 = "SELECT PlayerID FROM GameRoster WHERE Spot = 'D3' AND Team = $TeamNum"; $result_c1 = mysql_query ($query_c1, $connection); while ($row_c1 = mysql_fetch_array($result_c1)){ $PID = $row_c1["PlayerID"]; $LinePID[$i] = $PID; $LinePID2[$i] = $PID; $query_player = "SELECT LastName FROM Players WHERE PlayerID = $PID"; $result_player = mysql_query ($query_player, $connection); if(!$result_player){ die ("Could not query the database: ".mysql_error()); } while ($row_player = mysql_fetch_array($result_player)){ $LineNames[$i] = $LineNames[$i] . $row_player["LastName"] . '-'; } $query_stats = "SELECT * FROM PlayerStats WHERE Season = $SeasonNumber AND Type = '$SeasonType' AND Level = 1 AND PlayerID = $PID"; $result_stats = mysql_query ($query_stats, $connection); while ($row_stats = mysql_fetch_array ($result_stats)){ $LinePoints[$i] = $LinePoints[$i] + $row_stats["Pts"]; $LineGoals[$i] = $LineGoals[$i] + $row_stats["G"]; $LinePlus[$i] = $LinePlus[$i] + $row_stats["PlsMns"]; $LineShots[$i] = $LineShots[$i] + $row_stats["Shots"]; $LineChecks[$i] = $LineChecks[$i] + $row_stats["CheckGiven"]; $LineAvoid[$i] = $LineAvoid[$i] + $row_stats["CheckAvoided"]; } } $query_rw1 = "SELECT PlayerID FROM GameRoster WHERE Spot = 'D4' AND Team = $TeamNum"; $result_rw1 = mysql_query ($query_rw1, $connection); if(!$result_rw1){ die ("Could not query the database: ".mysql_error()); } while ($row_rw1 = mysql_fetch_array($result_rw1)){ $PID = $row_rw1["PlayerID"]; $query_player = "SELECT * FROM Players WHERE PlayerID = $PID"; $result_player = mysql_query ($query_player, $connection); if(!$result_player){ die ("Could not query the database: ".mysql_error()); } while ($row_player = mysql_fetch_array($result_player)){ $LineNames[$i] = $LineNames[$i] . $row_player["LastName"]; } $query_stats = "SELECT * FROM PlayerStats WHERE Season = $SeasonNumber AND Type = '$SeasonType' AND Level = 1 AND PlayerID = $PID"; $result_stats = mysql_query ($query_stats, $connection); while ($row_stats = mysql_fetch_array ($result_stats)){ $LinePoints[$i] = $LinePoints[$i] + $row_stats["Pts"]; $LineGoals[$i] = $LineGoals[$i] + $row_stats["G"]; $LinePlus[$i] = $LinePlus[$i] + $row_stats["PlsMns"]; $LineShots[$i] = $LineShots[$i] + $row_stats["Shots"]; $LineChecks[$i] = $LineChecks[$i] + $row_stats["CheckGiven"]; $LineAvoid[$i] = $LineAvoid[$i] + $row_stats["CheckAvoided"]; } } $LinePointsCheck[$i] = $LinePoints[$i]; $LinePointsCheck2[$i] = $LinePoints[$i]; $LineGoalsCheck[$i] = $LineGoals[$i]; $LineGoalsCheck2[$i] = $LineGoals[$i]; $LinePlusCheck[$i] = $LinePlus[$i]; $LinePlusCheck2[$i] = $LinePlus[$i]; $LineShotsCheck[$i] = $LineShots[$i]; $LineShotsCheck2[$i] = $LineShots[$i]; $LineChecksCheck[$i] = $LineChecks[$i]; $LineChecksCheck2[$i] = $LineChecks[$i]; $LineAvoidCheck[$i] = $LineAvoid[$i]; $LineAvoidCheck2[$i] = $LineAvoid[$i]; // line 3 $i++; $TeamName[$i] = $row_team["City"]; $LinePoints[$i] = 0; $LinePointsCheck[$i] = 0; $LineNames[$i] = " "; $LinePointsCheck2[$i] = 0; $LineGoals[$i] = 0; $LineGoalsCheck[$i] = 0; $LinePlus[$i] = 0; $LinePlusCheck[$i] = 0; $LineShots[$i] = 0; $LineChecks[$i] = 0; $LineAvoid[$i] = 0; $query_c1 = "SELECT PlayerID FROM GameRoster WHERE Spot = 'D5' AND Team = $TeamNum"; $result_c1 = mysql_query ($query_c1, $connection); while ($row_c1 = mysql_fetch_array($result_c1)){ $PID = $row_c1["PlayerID"]; $LinePID[$i] = $PID; $LinePID2[$i] = $PID; $query_player = "SELECT LastName FROM Players WHERE PlayerID = $PID"; $result_player = mysql_query ($query_player, $connection); if(!$result_player){ die ("Could not query the database: ".mysql_error()); } while ($row_player = mysql_fetch_array($result_player)){ $LineNames[$i] = $LineNames[$i] . $row_player["LastName"] . '-'; } $query_stats = "SELECT * FROM PlayerStats WHERE Season = $SeasonNumber AND Type = '$SeasonType' AND Level = 1 AND PlayerID = $PID"; $result_stats = mysql_query ($query_stats, $connection); while ($row_stats = mysql_fetch_array ($result_stats)){ $LinePoints[$i] = $LinePoints[$i] + $row_stats["Pts"]; $LineGoals[$i] = $LineGoals[$i] + $row_stats["G"]; $LinePlus[$i] = $LinePlus[$i] + $row_stats["PlsMns"]; $LineShots[$i] = $LineShots[$i] + $row_stats["Shots"]; $LineChecks[$i] = $LineChecks[$i] + $row_stats["CheckGiven"]; $LineAvoid[$i] = $LineAvoid[$i] + $row_stats["CheckAvoided"]; } } $query_rw1 = "SELECT PlayerID FROM GameRoster WHERE Spot = 'D6' AND Team = $TeamNum"; $result_rw1 = mysql_query ($query_rw1, $connection); if(!$result_rw1){ die ("Could not query the database: ".mysql_error()); } while ($row_rw1 = mysql_fetch_array($result_rw1)){ $PID = $row_rw1["PlayerID"]; $query_player = "SELECT * FROM Players WHERE PlayerID = $PID"; $result_player = mysql_query ($query_player, $connection); if(!$result_player){ die ("Could not query the database: ".mysql_error()); } while ($row_player = mysql_fetch_array($result_player)){ $LineNames[$i] = $LineNames[$i] . $row_player["LastName"]; } $query_stats = "SELECT * FROM PlayerStats WHERE Season = $SeasonNumber AND Type = '$SeasonType' AND Level = 1 AND PlayerID = $PID"; $result_stats = mysql_query ($query_stats, $connection); while ($row_stats = mysql_fetch_array ($result_stats)){ $LinePoints[$i] = $LinePoints[$i] + $row_stats["Pts"]; $LineGoals[$i] = $LineGoals[$i] + $row_stats["G"]; $LinePlus[$i] = $LinePlus[$i] + $row_stats["PlsMns"]; $LineShots[$i] = $LineShots[$i] + $row_stats["Shots"]; $LineChecks[$i] = $LineChecks[$i] + $row_stats["CheckGiven"]; $LineAvoid[$i] = $LineAvoid[$i] + $row_stats["CheckAvoided"]; } } $LinePointsCheck[$i] = $LinePoints[$i]; $LinePointsCheck2[$i] = $LinePoints[$i]; $LineGoalsCheck[$i] = $LineGoals[$i]; $LineGoalsCheck2[$i] = $LineGoals[$i]; $LinePlusCheck[$i] = $LinePlus[$i]; $LinePlusCheck2[$i] = $LinePlus[$i]; $LineShotsCheck[$i] = $LineShots[$i]; $LineShotsCheck2[$i] = $LineShots[$i]; $LineChecksCheck[$i] = $LineChecks[$i]; $LineChecksCheck2[$i] = $LineChecks[$i]; $LineAvoidCheck[$i] = $LineAvoid[$i]; $LineAvoidCheck2[$i] = $LineAvoid[$i]; } // end of $Top10Checker. } $i++; print "Top 10 Stats |
";
// Top 10 lines for points
$YesOrNo = 0;
rsort($LinePointsCheck);
for ($x = 0; $x < $i; $x++){
// print $x . " " . $TeamName[$x] . " " . $LineNames[$x] . " " . $LinePoints[$x] . " " . $LinePointsCheck[$x] . " " . $LinePID[$x] . " "; } for ($x = 0; $x < $i; $x++){ for ($j = 0; $j < $i; $j++){ if ($LinePoints[$j] == $LinePointsCheck[$x]){ for ($ab = 0; $ab < $i; $ab++){ if ($CheckPID[$ab] == $LinePID[$j]){ $YesOrNo = 1; // print $CheckPID[$ab] . '->' . $LinePID[$j] . ' '; } } if ($YesOrNo == 1){ } else { $LoopCheck[$x] = $j; $CheckPID[$x] = $LinePID[$j]; // print $x . ') ->' . $CheckPID[$x] . ' '; } $YesOrNo = 0; } } } print "Most Points "; print "
"; } for ($x = 0; $x < $i; $x++){ for ($j = 0; $j < $i; $j++){ if ($LinePoints[$j] == $LinePointsCheck2[$x]){ for ($ab = 0; $ab < $i; $ab++){ if ($CheckPID2[$ab] == $LinePID2[$j]){ $YesOrNo = 1; // print $CheckPID2[$ab] . '->' . $LinePID2[$j] . ' '; } } if ($YesOrNo == 1){ } else { $LoopCheck2[$x] = $j; $CheckPID2[$x] = $LinePID2[$j]; // print $x . ') ->' . $CheckPID2[$x] . ' '; } $YesOrNo = 0; } } } print " | ";
print "Least Points "; print "
| ||||||||||||||||
";
// Top 10 lines for goals
$YesOrNo = 0;
rsort($LineGoalsCheck);
for ($x = 0; $x < $i; $x++){
// print $x . " " . $TeamName[$x] . " " . $LineNames[$x] . " " . $LinePoints[$x] . " " . $LinePointsCheck[$x] . " " . $LinePID[$x] . " "; } for ($x = 0; $x < $i; $x++){ for ($j = 0; $j < $i; $j++){ if ($LineGoals[$j] == $LineGoalsCheck[$x]){ for ($ab = 0; $ab < $i; $ab++){ if ($CheckPID3[$ab] == $LinePID[$j]){ $YesOrNo = 1; // print $CheckPID3[$ab] . '->' . $LinePID[$j] . ' '; } } if ($YesOrNo == 1){ } else { $LoopCheck[$x] = $j; $CheckPID3[$x] = $LinePID[$j]; // print $x . ') ->' . $CheckPID3[$x] . ' '; } $YesOrNo = 0; } } } print "Most Goals "; print "
"; } for ($x = 0; $x < $i; $x++){ for ($j = 0; $j < $i; $j++){ if ($LineGoals[$j] == $LineGoalsCheck2[$x]){ for ($ab = 0; $ab < $i; $ab++){ if ($CheckPID4[$ab] == $LinePID2[$j]){ $YesOrNo = 1; // print $CheckPID4[$ab] . '->' . $LinePID2[$j] . ' '; } } if ($YesOrNo == 1){ } else { $LoopCheck2[$x] = $j; $CheckPID4[$x] = $LinePID2[$j]; // print $x . ') ->' . $CheckPID4[$x] . ' '; } $YesOrNo = 0; } } } print " | ";
print "Least Goals "; print "
| ||||||||||||||||
";
// Top 10 lines for + / -
$YesOrNo = 0;
rsort($LinePlusCheck);
for ($x = 0; $x < $i; $x++){
// print $x . " " . $TeamName[$x] . " " . $LineNames[$x] . " " . $LinePoints[$x] . " " . $LinePointsCheck[$x] . " " . $LinePID[$x] . " "; } for ($x = 0; $x < $i; $x++){ for ($j = 0; $j < $i; $j++){ if ($LinePlus[$j] == $LinePlusCheck[$x]){ for ($ab = 0; $ab < $i; $ab++){ if ($CheckPID5[$ab] == $LinePID[$j]){ $YesOrNo = 1; // print $CheckPID5[$ab] . '->' . $LinePID[$j] . ' '; } } if ($YesOrNo == 1){ } else { $LoopCheck[$x] = $j; $CheckPID5[$x] = $LinePID[$j]; // print $x . ') ->' . $CheckPID5[$x] . ' '; } $YesOrNo = 0; } } } print "Most +/- "; print "
"; } for ($x = 0; $x < $i; $x++){ for ($j = 0; $j < $i; $j++){ if ($LinePlus[$j] == $LinePlusCheck2[$x]){ for ($ab = 0; $ab < $i; $ab++){ if ($CheckPID6[$ab] == $LinePID2[$j]){ $YesOrNo = 1; // print $CheckPID6[$ab] . '->' . $LinePID2[$j] . ' '; } } if ($YesOrNo == 1){ } else { $LoopCheck2[$x] = $j; $CheckPID6[$x] = $LinePID2[$j]; // print $x . ') ->' . $CheckPID6[$x] . ' '; } $YesOrNo = 0; } } } print " | ";
print "Least +/- "; print "
| ||||||||||||||||
"; print " | |||||||||||||||||
";
// Top 10 lines for shots
$YesOrNo = 0;
rsort($LineShotsCheck);
for ($x = 0; $x < $i; $x++){
// print $x . " " . $TeamName[$x] . " " . $LineNames[$x] . " " . $LinePoints[$x] . " " . $LinePointsCheck[$x] . " " . $LinePID[$x] . " "; } for ($x = 0; $x < $i; $x++){ for ($j = 0; $j < $i; $j++){ if ($LineShots[$j] == $LineShotsCheck[$x]){ for ($ab = 0; $ab < $i; $ab++){ if ($Check7PID[$ab] == $LinePID[$j]){ $YesOrNo = 1; // print $Check7PID[$ab] . '->' . $LinePID[$j] . ' '; } } if ($YesOrNo == 1){ } else { $LoopCheck[$x] = $j; $Check7PID[$x] = $LinePID[$j]; // print $x . ') ->' . $Check7PID[$x] . ' '; } $YesOrNo = 0; } } } print "Most Shots "; print "
"; } for ($x = 0; $x < $i; $x++){ for ($j = 0; $j < $i; $j++){ if ($LineShots[$j] == $LineShotsCheck2[$x]){ for ($ab = 0; $ab < $i; $ab++){ if ($CheckPID8[$ab] == $LinePID2[$j]){ $YesOrNo = 1; // print $CheckPID8[$ab] . '->' . $LinePID2[$j] . ' '; } } if ($YesOrNo == 1){ } else { $LoopCheck2[$x] = $j; $CheckPID8[$x] = $LinePID2[$j]; // print $x . ') ->' . $CheckPID8[$x] . ' '; } $YesOrNo = 0; } } } print " | ";
print "Least Shots "; print "
| ||||||||||||||||
";
// Top 10 lines for checks given
$YesOrNo = 0;
rsort($LineChecksCheck);
for ($x = 0; $x < $i; $x++){
// print $x . " " . $TeamName[$x] . " " . $LineNames[$x] . " " . $LinePoints[$x] . " " . $LinePointsCheck[$x] . " " . $LinePID[$x] . " "; } for ($x = 0; $x < $i; $x++){ for ($j = 0; $j < $i; $j++){ if ($LineChecks[$j] == $LineChecksCheck[$x]){ for ($ab = 0; $ab < $i; $ab++){ if ($CheckPID9[$ab] == $LinePID[$j]){ $YesOrNo = 1; // print $CheckPID9[$ab] . '->' . $LinePID[$j] . ' '; } } if ($YesOrNo == 1){ } else { $LoopCheck[$x] = $j; $CheckPID9[$x] = $LinePID[$j]; // print $x . ') ->' . $CheckPID9[$x] . ' '; } $YesOrNo = 0; } } } print "Most Checks Given "; print "
"; } for ($x = 0; $x < $i; $x++){ for ($j = 0; $j < $i; $j++){ if ($LineChecks[$j] == $LineChecksCheck2[$x]){ for ($ab = 0; $ab < $i; $ab++){ if ($CheckPID10[$ab] == $LinePID2[$j]){ $YesOrNo = 1; // print $CheckPID10[$ab] . '->' . $LinePID2[$j] . ' '; } } if ($YesOrNo == 1){ } else { $LoopCheck2[$x] = $j; $CheckPID10[$x] = $LinePID2[$j]; // print $x . ') ->' . $CheckPID10[$x] . ' '; } $YesOrNo = 0; } } } print " | ";
print "Least Checks Given "; print "
| ||||||||||||||||
";
// Top 10 lines for checks avoided
$YesOrNo = 0;
rsort($LineAvoidCheck);
for ($x = 0; $x < $i; $x++){
// print $x . " " . $TeamName[$x] . " " . $LineNames[$x] . " " . $LinePoints[$x] . " " . $LinePointsCheck[$x] . " " . $LinePID[$x] . " "; } for ($x = 0; $x < $i; $x++){ for ($j = 0; $j < $i; $j++){ if ($LineAvoid[$j] == $LineAvoidCheck[$x]){ for ($ab = 0; $ab < $i; $ab++){ if ($CheckPID11[$ab] == $LinePID[$j]){ $YesOrNo = 1; // print $CheckPID11[$ab] . '->' . $LinePID[$j] . ' '; } } if ($YesOrNo == 1){ } else { $LoopCheck[$x] = $j; $CheckPID11[$x] = $LinePID[$j]; // print $x . ') ->' . $CheckPID11[$x] . ' '; } $YesOrNo = 0; } } } print "Most Checks Avoided "; print "
"; } for ($x = 0; $x < $i; $x++){ for ($j = 0; $j < $i; $j++){ if ($LineAvoid[$j] == $LineAvoidCheck2[$x]){ for ($ab = 0; $ab < $i; $ab++){ if ($CheckPID12[$ab] == $LinePID2[$j]){ $YesOrNo = 1; // print $CheckPID12[$ab] . '->' . $LinePID2[$j] . ' '; } } if ($YesOrNo == 1){ } else { $LoopCheck2[$x] = $j; $CheckPID12[$x] = $LinePID2[$j]; // print $x . ') ->' . $CheckPID12[$x] . ' '; } $YesOrNo = 0; } } } print " | ";
print "Least Checks Avoided "; print "
|