<?php
include("connect.php");
/*
for($x=21;$x<=26;$x++){
$insert_grades=$dbh->query("insert into grades (schoolclass,schoolyear,schoolterm,grade) values('$x','18','1','D1')");
$insert_grades=$dbh->query("insert into grades (schoolclass,schoolyear,schoolterm,grade) values('$x','18','1','D2')");
$insert_grades=$dbh->query("insert into grades (schoolclass,schoolyear,schoolterm,grade) values('$x','18','1','C3')");
$insert_grades=$dbh->query("insert into grades (schoolclass,schoolyear,schoolterm,grade) values('$x','18','1','C4')");
$insert_grades=$dbh->query("insert into grades (schoolclass,schoolyear,schoolterm,grade) values('$x','18','1','C5')");
$insert_grades=$dbh->query("insert into grades (schoolclass,schoolyear,schoolterm,grade) values('$x','18','1','C6')");
$insert_grades=$dbh->query("insert into grades (schoolclass,schoolyear,schoolterm,grade) values('$x','18','1','P7')");
$insert_grades=$dbh->query("insert into grades (schoolclass,schoolyear,schoolterm,grade) values('$x','18','1','P8')");
$insert_grades=$dbh->query("insert into grades (schoolclass,schoolyear,schoolterm,grade) values('$x','18','1','F9')");
}


$result_scrap=$dbh->query("select * from scrap where type='secsub' or type='prisubp' or type='prisubps'");
$row_scrap=$result_scrap->fetchObject();
$count_scrap=$result_scrap->rowCount();

if($count_scrap>0){
do{
$from=$row_scrap->item."from";
$to=$row_scrap->item."to";

for($x=21;$x<=26;$x++){
$update_grades=$dbh->query("update grades set $from='80', $to='100' where grade='D1' and schoolclass='$x'");
$update_grades=$dbh->query("update grades set $from='71', $to='79' where grade='D2' and schoolclass='$x'");
$update_grades=$dbh->query("update grades set $from='65', $to='70' where grade='C3' and schoolclass='$x'");
$update_grades=$dbh->query("update grades set $from='60', $to='64' where grade='C4' and schoolclass='$x'");
$update_grades=$dbh->query("update grades set $from='55', $to='59' where grade='C5' and schoolclass='$x'");
$update_grades=$dbh->query("update grades set $from='50', $to='54' where grade='C6' and schoolclass='$x'");
$update_grades=$dbh->query("update grades set $from='41', $to='49' where grade='P7' and schoolclass='$x'");
$update_grades=$dbh->query("update grades set $from='35', $to='40' where grade='P8' and schoolclass='$x'");
$update_grades=$dbh->query("update grades set $from='0', $to='34' where grade='F9' and schoolclass='$x'");

}
}while($row_scrap=$result_scrap->fetchObject());
}
*/

for($x=21;$x<=24;$x++){
$update_classes=$dbh->query("update citadel set sub52marks='0', sub54marks='0', sub53marks='0', sub48marks='0', sub50marks='0' where schoolclass='$x'");

}
/*

$result_t1=$dbh->query("select * from t1 where schoolyear='18'");
$row_t1=$result_t1->fetchObject();
$count_t1=$result_t1->rowCount();

if($count_t1>0){
do{
$insert_citadel=$dbh->query("insert into citadel (schoolyear,term,schoolclass,cid) values('$row_t1->schoolyear','1','$row_t1->schoolclass','$row_t1->cid')");

}while($row_t1=$result_t1->fetchObject());
}
*/
/*
p4-p7 sci,sst,re
secondary all compulsory 7

che,geo,phy,bio,hist
*/
?>