$endtime) { //Then this is the right week //echo "Week with deadline of $endtime is the current week
"; $validtime = 1; $contestyear = $row["Year"]; $contestweek = $row["Week"]; $lastweek = $contestweek -1; $conteststring = $row["DateString"]; break; } } //Begin to generate guts of web page echo ("

PFCC $contestyear Game Consensus


Week $contestweek, $conteststring

"); if ($contestweek != 18) { echo("

The following represents the consensus picks for this week's games.  These picks represent the average pick for each game from all members submitting picks this week, as well as from the Top 10 and Top 25 members according to the standings as of last week. Each game listed below is a link to the breakdown for that game.

"); } else { echo("

The following represents the consensus picks for the Super Bowl Blowout.  These picks represent the average pick for each playoff team from all members submitting picks this week, as well as from the Top 10 and Top 25 members according to the standings as of last week.

"); } if ($contestweek != 18) { echo (" "); }else{ echo(" "); } echo (" "); //Before we go on we have to query for games for this week and picks $weeknumb = 0 + $contestweek; $weekyear = substr($contestyear,2,2); $picksfile = "PFCCPicks$weeknumb$weekyear"; $gamefile = "PFCCGames$weeknumb$weekyear"; $totalstable = "PFCCTotals$lastweek$weekyear"; $sql = "select * from $gamefile"; $result = mysql_query($sql); $numb_games = mysql_num_rows($result); while ($row = mysql_fetch_array($result)) { $Team1[]=$row["Team1"]; $Team2[]=$row["Team2"]; $AtVs[]=$row["AtVs"]; $ID[] =$row["ID"]; } $sql = "select * from $picksfile where MemberHandle = '$MemberHandle'"; $result = mysql_query($sql); $row = mysql_fetch_array($result); //Grab Consensus Info //First Find Total Players $sql = "SELECT COUNT(MemberHandle) from $picksfile"; $result2 = mysql_query($sql); $row2 = mysql_fetch_array($result2); $totalplayers = $row2[0]; for ($i=1; $i<$numb_games+1; ++$i) { $Con = "C$i"; $Win = "W$i"; $sql2 = "SELECT -1*(SUM($Con)) from $picksfile where $Win = 1"; $result2 = mysql_query($sql2); $sql3 = "SELECT (SUM($Con)) from $picksfile where $Win = 2"; //Special Case for Blowout if ($contestweek == 18) { $sql3 = "SELECT (SUM($Con)) from $picksfile"; } $result3 = mysql_query($sql3); $row2 = mysql_fetch_array($result2); $row3 = mysql_fetch_array($result3); $avg = ($row2[0] + $row3[0])/$totalplayers; $absavg = abs($avg); $roundavg = round($avg,0); $conffullraw[$i] = $roundavg; $roundavg2 = round($absavg,0); $conffull[$i] = $roundavg2; if ($contestweek != 1) { //Again for Top 25 $sql2 = "SELECT -1*(SUM($picksfile.C$i)) from $picksfile, $totalstable where $totalstable.MemberHandle = $picksfile.MemberHandle and $totalstable.Place < 26 and $picksfile.W$i = 1"; $result2 = mysql_query($sql2); $sql3 = "SELECT SUM($picksfile.C$i) from $picksfile, $totalstable where $totalstable.MemberHandle = $picksfile.MemberHandle and $totalstable.Place < 26 and $picksfile.W$i = 2"; //Special Case for Blowout if ($contestweek == 18) { $sql3 = "SELECT SUM($picksfile.C$i) from $picksfile, $totalstable where $totalstable.MemberHandle = $picksfile.MemberHandle and $totalstable.Place < 26"; } $result3 = mysql_query($sql3); $row2 = mysql_fetch_array($result2); $row3 = mysql_fetch_array($result3); $avg = ($row2[0] + $row3[0])/25; $absavg = abs($avg); $roundavg = round($avg,0); $conffullraw25[$i] = $roundavg; $roundavg2 = round($absavg,0); $conffull25[$i] = $roundavg2; //Again for Top 10 $sql2 = "SELECT -1*(SUM($picksfile.C$i)) from $picksfile, $totalstable where $totalstable.MemberHandle = $picksfile.MemberHandle and $totalstable.Place < 11 and $picksfile.W$i = 1"; $result2 = mysql_query($sql2); $sql3 = "SELECT SUM($picksfile.C$i) from $picksfile, $totalstable where $totalstable.MemberHandle = $picksfile.MemberHandle and $totalstable.Place < 11 and $picksfile.W$i = 2"; //Special Case for Blowout if ($contestweek == 18) { $sql3 = "SELECT SUM($picksfile.C$i) from $picksfile, $totalstable where $totalstable.MemberHandle = $picksfile.MemberHandle and $totalstable.Place < 11"; } $result3 = mysql_query($sql3); $row2 = mysql_fetch_array($result2); $row3 = mysql_fetch_array($result3); $avg = ($row2[0] + $row3[0])/10; $absavg = abs($avg); $roundavg = round($avg,0); $conffullraw10[$i] = $roundavg; $roundavg2 = round($absavg,0); $conffull10[$i] = $roundavg2; } else { $confstring25 = "Even"; $confstring10 = "Even"; } } for ($i = 0; $i<=$numb_games-1; $i++) { $pos1 = $i*2+2; $pos2 = $i*2+3; $Pick = $row[$pos1]; if ($Pick == 1) { $Winner = $Team1[$i]; } else { $Winner = $Team2[$i]; } $Confidence = $row[$pos2]; $conf = $conffull[$i+1]; if (($conffullraw[$i+1] > 0)) { $cteam = $Team2[$i]; $confstring = "$cteam $conf"; } elseif ($conffullraw[$i+1] < 0) { $cteam = $Team1[$i]; $confstring = "$cteam $conf"; } else { $confstring = "Even"; } if ($contestweek != 1) { $conf25 = $conffull25[$i+1]; if (($conffullraw25[$i+1] > 0)) { $cteam = $Team2[$i]; $confstring25 = "$cteam $conf25"; } elseif ($conffullraw25[$i+1] < 0) { $cteam = $Team1[$i]; $confstring25 = "$cteam $conf25"; } else { $confstring25 = "Even"; } $conf10 = $conffull10[$i+1]; if (($conffullraw10[$i+1] > 0)) { $cteam = $Team2[$i]; $confstring10 = "$cteam $conf10"; } elseif ($conffullraw10[$i+1] < 0) { $cteam = $Team1[$i]; $confstring10 = "$cteam $conf10"; } else { $confstring10 = "Even"; } } //Write Consensus Table if ($contestweek != 18) { echo(" "); }else{ echo(" "); } echo(" "); } echo ("
GamePlayoff TeamAll Member Consensus Top 25 Consensus Top 10 Consensus
$Team1[$i] $AtVs[$i] $Team2[$i]
$Team1[$i]$confstring $confstring25 $confstring10

Individual PFCC Picks

Latest PFCC Standings

"); include("../php_includes/footer.inc");