$query = "select gamenum, date, hteam, ateam from schedule where hteam = '$_GET[name]' or ateam = '$_GET[name]'"; $runquery = mysql_query($query); while ($row = mysql_fetch_assoc($runquery)) {
if (substr($row[date],1,1) == "1") { $month1[] = $row; $games[1] = $month1; }
if (substr($row[date],1,1) == "2") { $month2[] = $row; $games[2] = $month2; }
if (substr($row[date],1,1) == "3") { $month3[] = $row; $games[3] = $month3; }
if (substr($row[date],1,1) == "4") { $month4[] = $row; $games[4] = $month4; }
if (substr($row[date],1,1) == "5") { $month5[] = $row; $games[5] = $month5; }
if (substr($row[date],1,1) == "6") { $month6[] = $row; $games[6] = $month6; }
if (substr($row[date],1,1) == "7") { $month7[] = $row; $games[7] = $month7; }
if (substr($row[date],1,1) == "8") { $month8[] = $row; $games[8] = $month8; }
if (substr($row[date],1,1) == "9") { $month9[] = $row; $games[9] = $month9; }
if (substr($row[date],0,-3) == "10") { $month10[] = $row; $games[10] = $month10; }
if (substr($row[date],0,-3) == "11") { $month11[] = $row; $games[11] = $month11; }
if (substr($row[date],0,-3) == "12") { $month12[] = $row; $games[12] = $month12; }
}
for ($i = 1; $i <= 12; $i++) {
$url = $_SERVER[PHP_SELF].'?name='.$_GET[name].'&gameaction='.$_GET[gameaction].'&game=';
if ($games[$i] == $null) { echo $null; } else {
echo '<div style="float:left; border: 1px solid; margin:5px; padding:5px">';
foreach ($games[$i] as $value) { echo substr($value[date],1).' <a href="'.$url.$value[gamenum].'">'.ucfirst($value[hteam]).' vs. '.ucfirst($value[ateam]).'</a><br>'; } echo '</div>'; }
} // for bracket