$q=mysql_query("SELECT COUNT(id) AS num FROM schools WHERE year='$year'");
$r=mysql_fetch_object($q);
$numberofschools=$r->num;
echoi18n("Number of schools: %1",array($numberofschools))."<br />";
//number of schools
$q=mysql_query("SELECT DISTINCT(students.schools_id) AS sid FROM students,registrations WHERE students.registrations_id=registrations.id AND students.year='$year' AND registrations.year='$year' AND (registrations.status='complete' OR registrations.status='paymentpending')");
echomysql_error();
$numberofactiveschools=mysql_num_rows($q);
echoi18n("Number of active schools: %1",array($numberofactiveschools))."<br />";
//total number of students:
$q=mysql_query("SELECT COUNT(students.id) AS num FROM students,registrations WHERE students.registrations_id=registrations.id AND students.year='$year' AND registrations.year='$year' AND (registrations.status='complete' OR registrations.status='paymentpending')");
$r=mysql_fetch_object($q);
$numberofstudents=$r->num;
echoi18n("Number of students: %1",array($numberofstudents))."<br />";
echomysql_error();
//number of students per grade per gender
$q=mysql_query("SELECT COUNT(students.id) AS num, students.grade, students.sex FROM students,registrations WHERE students.registrations_id=registrations.id AND students.year='$year' AND registrations.year='$year' AND (registrations.status='complete' OR registrations.status='paymentpending') GROUP BY students.grade, students.sex");
echomysql_error();
while($r=mysql_fetch_object($q)){
if($r->grade<=6)
$nums["6down"][$r->sex]+=$r->num;
elseif($r->grade>6&&$r->grade<=8)
$nums["78"][$r->sex]+=$r->num;
elseif($r->grade>8&&$r->grade<=10)
$nums["910"][$r->sex]+=$r->num;
elseif($r->grade>10)
$nums["11up"][$r->sex]+=$r->num;
}
echo"Student participation (by age group/gender)<br />";
$q=mysql_query("SELECT MAX(students.grade) grade FROM students,registrations,projects WHERE students.registrations_id=registrations.id AND projects.registrations_id=registrations.id AND students.year='$year' AND registrations.year='$year' AND projects.year='$year' AND (registrations.status='complete' OR registrations.status='paymentpending') GROUP BY projects.id");
$q=mysql_query("SELECT COUNT(id) AS num FROM committees_members WHERE deleted='N'");
$r=mysql_fetch_object($q);
$numcommittee=$r->num;
echoi18n("Committee Members: %1 (note: this is CURRENT number of active committee members as of right now! There is no way to extract committee member numbers from previous years)",array($r->num));
echo"<br />";
$q=mysql_query("SELECT COUNT(id) AS num FROM judges,judges_years WHERE judges_years.judges_id=judges.id AND judges_years.year='$year' AND judges.complete='yes' AND judges.deleted='no'");