'; echo 'RankSchoolScore'; while (list($num, $line) = each($results)) { list($rank, $school, $score) = split("\t", rtrim($line)); if ($rank > $maxrank) break; echo "$rank$school$score\n"; } echo ''; } function individual_table($infile, $maxrank) { $results = file($infile); echo ''; echo ''; while (list($num, $line) = each($results)) while (list($num, $line) = each($results)) { list($rank, $name, $school, $score) = split("\t", rtrim($line)); if ($rank > $maxrank) break; echo "\n"; } echo '
RankStudentSchoolScore
$rank$name$school$score
'; } function team_table($infile, $maxrank, $cutoff) { $results = file($infile); echo ''; echo ''; $imfirst = 0; while (list($num, $line) = each($results)) { list($rank, $name_, $score) = split("\t", rtrim($line)); $name = trim($name_); if ($rank > 0) { if ($imfirst == 2) { if ($the_score > 0 || $members > 0) echo $entry.")\n"; } else if ($imfirst == 1) { if ($the_score > 0 || $members > 0) echo $entry."\n"; } $the_score = $score; if ($rank > $maxrank && $the_score < $cutoff) break; $entry = "
RankTeamScore
$the_score
$the_score
$rank$name
"; $imfirst=1; $members=0; } else { if ($imfirst == 1) { $entry .= "($name"; $imfirst = 2; } else { $entry .= ", $name"; } $members++; } } echo '
'; } ?> Junior High Math Competition - <? echo $y; ?> Results

Junior High Math Competition - Results

Division AA School Totals

'; totals_table("$y/results_aa/school_totals.txt", 1000); echo '

Division A School Totals

'; totals_table("$y/results_a/school_totals.txt", 1000); echo ' 7th Grade Individual
7th Grade Team
8th Grade Individual
8th Grade Team
Creative Thinking 7th Grade Individual
7th Grade Team
8th Grade Individual
8th Grade Team
Creative Thinking '; } if (strcmp($q, "7in") == 0) { $div = $HTTP_GET_VARS["d"]; echo '

Division '.strtoupper($div).' - 7th Grade Individual

'; echo '

School Totals

'; totals_table("$y/results_$div/seventh_grade_individual_by_school.txt", 1000); echo '

Individual Scores

'; individual_table("$y/results_$div/seventh_grade_individual.txt", 10); } if (strcmp($q, "8in") == 0) { $div = $HTTP_GET_VARS["d"]; echo '

Division '.strtoupper($div).' - 8th Grade Individual

'; echo '

School Totals

'; totals_table("$y/results_$div/eighth_grade_individual_by_school.txt", 1000); echo '

Individual Scores

'; individual_table("$y/results_$div/eighth_grade_individual.txt", 10); } if (strcmp($q, "7te") == 0) { $div = $HTTP_GET_VARS["d"]; echo '

Division '.strtoupper($div).' - 7th Grade Teams

'; echo '

School Totals

'; totals_table("$y/results_$div/seventh_grade_teams_by_school.txt", 1000); echo '

Team Scores

'; team_table("$y/results_$div/seventh_grade_teams.txt", 10, 1000); } if (strcmp($q, "8te") == 0) { $div = $HTTP_GET_VARS["d"]; echo '

Division '.strtoupper($div).' - 8th Grade Teams

'; echo '

School Totals

'; totals_table("$y/results_$div/eighth_grade_teams_by_school.txt", 1000); echo '

Team Scores

'; team_table("$y/results_$div/eighth_grade_teams.txt", 10, 1000); } if (strcmp($q, "ct") == 0) { $div = $HTTP_GET_VARS["d"]; echo '

Division '.strtoupper($div).' - Creative Thinking

'; echo '

School Totals

'; totals_table("$y/results_$div/creative_thinking_by_school.txt", 1000); echo '

Team Scores

'; if (strcmp($div, "aa") == 0) team_table("$y/results_$div/creative_thinking.txt", 10, 42); else team_table("$y/results_$div/creative_thinking.txt", 16, 1000); } ?>