prepare("select * from average where grades = :a ") ; $alpha->bindparam(':a', $af) ; $alpha->execute() ; if($alpha->rowcount() > 0) { $rowds = $alpha->FETCH(PDO::FETCH_ASSOC) ; $as = $rowds['start'] ; $ae = $rowds['end'] ; } //get credits grade $cd = 'Credit' ; $crd = $DBcon->prepare( "select * from average where grades = :c ") ; $crd->bindparam(':c', $cd) ; $crd->execute() ; if($crd->rowcount() > 0) { $rowcr = $crd->FETCH(PDO::FETCH_ASSOC) ; $cs = $rowcr['start'] ; $ce = $rowcr['end'] ; } //get pass grade $p = 'Pass' ; $pass = $DBcon->prepare("select * from average where grades = :p ") ; $pass->bindparam(':p' , $p) ; $pass->execute() ; if($pass->rowcount() > 0) { $rowps = $pass->FETCH(PDO::FETCH_ASSOC) ; $ps = $rowps['start'] ; $pe = $rowps['end'] ; } //get failure grades $f = 'Fail' ; $fail =$DBcon->prepare("select * from average where grades =:f ") ; $fail->bindparam(':f' , $f) ; $fail->execute() ; if($fail->rowcount() > 0) { $rowfl = $fail->FETCH(PDO::FETCH_ASSOC) ; $fs = $rowfl['start'] ; $fe = $rowfl['end'] ; } //get promotional average $pa = 'Promotion Average' ; $pro = $DBcon->prepare("select * from average where grades = :pr "); $pro->bindparam(':pr' , $pa) ; $pro->execute() ; if($pro->rowcount() > 0) { $rowpro = $pro->FETCH(PDO::FETCH_ASSOC) ; $prs = $rowpro['start'] ; $pre = $rowpro['end'] ; } //end.... //VARIABLES $pin = $_SESSION['pin'] ; $classid = $_SESSION["classid"] ; $schyear = $_SESSION["schsesion"] ; $term = $_SESSION["term"] ; $regno = $_SESSION["rgno"] ; // $classtotal = $_SESSION["classnumc"] ; //$level = substr($classid, 0, 4); //$level1 = substr($classid, 0, 5); $myArr = array(); //get student name from students table $sqlname = $DBcon->prepare("select * from students where regno = :reg " ) ; $sqlname->bindparam(':reg' , $regno) ; $sqlname->execute() ; if ($sqlname->rowcount() > 0) { $rowa = $sqlname->FETCH(PDO::FETCH_ASSOC) ; $studname = $rowa['studentname'] ; $md = $rowa['middlename'] ; $ln = $rowa['lastname'] ; $avat = $rowa['avatar'] ; $names = $studname.' '.$md.' '.$ln ; } //GET NUMBER IN CLASS IN THIRD TERM $sqlpoc = $DBcon->prepare(" select distinct stregno from marks where (term =:tm and acad_session = :yr ) and stclass= :kls " ); $sqlpoc->bindparam(':tm' , $term) ; $sqlpoc->bindparam(':yr' , $schyear) ; $sqlpoc->bindparam(':kls' , $classid) ; $sqlpoc->execute() ; $numbt = $sqlpoc->rowcount() ; //$_SESSION["classnumt"] = $numbt ; //END //get minimum no of subject $level = getm($classid) ; $sqlm = $DBcon->prepare("select * from subjno where (classlevel = :kls and term = :tm) and yr = :y ") ; $sqlm->bindparam(':kls' , $level) ; $sqlm->bindparam(':tm' , $term) ; $sqlm->bindparam(':y',$schyear) ; $sqlm->execute() ; $rowm = $sqlm->FETCH(PDO::FETCH_ASSOC) ; $min = $rowm['nos'] ; //end.... //get next term fees and resumption $sqlt = $DBcon->prepare("select * from next" ) ; //$sqlname->bindparam(':reg' , $regno) ; $sqlt->execute() ; if ($sqlt->rowcount() > 0) { $rowat = $sqlt->FETCH(PDO::FETCH_ASSOC) ; $nxtf = $rowat['fees'] ; $nxtr = $rowat['resume'] ; } /* Student Image */ ?>
header

Term Class
Student Image
Name : House  
Reg. No Session
prepare("select * from marks where ( (stregno = :reg and acad_session = :yr) and (term = :tm and stclass = :kls) ) ") ; $sql->bindparam(':reg',$regno) ; $sql->bindparam(':yr',$schyear) ; $sql->bindparam(':tm',$term) ; $sql->bindparam(':kls',$classid) ; $sql->execute() ; $num_rows = $sql->rowcount() ; while ($row = $sql->FETCH(PDO::FETCH_ASSOC)) { $sbjid = $row['subject_id'] ; $sqlsbj = $DBcon->prepare("select subject_id, subjectname from subjects where subject_id = :id") ; $sqlsbj->bindparam(':id',$sbjid ) ; $sqlsbj->execute() ; //$getsubj = mysql_query($sqlsbj) ; $rowsub = $sqlsbj->FETCH(PDO::FETCH_ASSOC) ; $mysubj = $rowsub['subjectname'] ; $asses1 = $row['test'] ; $asses2 = $row['midterm']; $exam = $row['exam'] ; //$subj = $row['subject'] ; $total = $asses1 + $asses2 + $exam ; $myArr[] = $total; // //} //$totalscore = $initial + $total ; if ($total <= $fe) { $grade = 'F' ; //$comment = 'FAIL' ; } elseif( ($total >= $ps) && ($total <= $pe) ) { $grade = 'P' ; // $comment = 'PASS' ; } elseif( ($total >= $cs) && ($total <= $ce) ) { $grade = 'C' ; //$comment = 'CREDIT' ; } elseif( ($total >= $as) && ($total <= $ae) ) { $grade = 'A' ; //$comment = 'DISTINCTION' ; } else $grade = '' ; //remarks if( ($total >= 80) && ($total <= 100) ) { $remarks = 'Excellent' ; } elseif( ($total >= 70) && ($total <= 79.99) ) { $remarks = 'V.Good' ; } elseif( ($total >= 50) && ($total <= 69.99) ) { $remarks = 'Good' ; } elseif( ($total >= 40) && ($total <= 49.99) ) { $remarks = 'Fair' ; } elseif( ($total <= 39.99) ) { $remarks = 'Poor' ; } echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; //begin subject position $subj = $row['subject_id'] ; $subjp = array() ; $pst = $DBcon->prepare("select subject_id, test, midterm, exam from marks where (term = '$term' and acad_session = '$schyear') and (stclass = '$classid' and subject_id = $subj)") ; $pst->execute() ; while($rw = $pst->fetch(pdo::FETCH_ASSOC)) { $tc = $rw['test'] ; $md = $rw['midterm'] ; $te = $rw['exam'] ; $tt = $tc + $md + $te ; $subjp[] = $tt ; } arsort($subjp) ; $psm = 0 ; foreach($subjp as $totm) { $psm++ ; $appm = position($psm) ; if($total == $totm) { $spm = $psm.$appm ; //echo $ps.$app ; break ; } } echo ""; echo ""; echo ""; echo "" ; //echo ""; } $count = 0 ; foreach ($myArr as $value) { $count += $value ; //$count = $count + $value ; } //get minimum no of Subject $sqlm = $DBcon->prepare("select * from subjno where (classlevel =:kls and term =:tm) and yr =:y ") ; $sqlm->bindparam(':kls',$level) ; $sqlm->bindparam(':tm',$term) ; $sqlm->bindparam(':y',$schyear) ; $sqlm->execute() ; $rowm = $sqlm->FETCH(PDO::FETCH_ASSOC) ; $min = $rowm['nos'] ; if($num_rows < $min) $average = $count / $min ; else $average = $count / $num_rows ; if ($average < 40) $comments = 'FAIL, POOR RESULT, SIT UP' ; elseif (($average >= 40) && ($average <= 54.99)) $comments = 'Fair result, Be more serious for a better result next term' ; elseif (($average >= 55) && ($average <= 69.99)) $comments = 'Good Result , Keep it up' ; elseif (($average >= 70) && ($average <= 100)) $comments = 'Very Good Result, Keep it Up' ; else $comments = 'Nill' ; ?>
SUBJECTS 1st CA 2ND CA EXAM TOTAL POSITION GRADE REMARK
" . $mysubj . "" . $row['test'] . "" . $row['midterm'] . "" . $row['exam'] . "" . $total . "" . $spm . "" . $grade . "" . $remarks . "
 
Key to Grades : A : 70 - 100, C : 55 - 69.99 , P : 40 - 54.99 , F : 0 - 39.99
Total Score:    ,   Average:    ,   Position:    prepare("select * from marks where (stclass = :kls and acad_session = :yr) and (stregno = :reg and term =:tm) ") ; $so->bindparam(':kls' , $classid) ; $so->bindparam(':yr' , $schyear) ; $so->bindparam(':reg' , $regno) ; $so->bindparam(':tm' , $term) ; $so->execute() ; //$res = mysql_query($so) or die('Error: ' . mysql_error()) ; while ($ro = $so->FETCH(PDO::FETCH_ASSOC)) { $fst = $ro['test'] ; $sc = $ro['midterm'] ; $exa = $ro['exam'] ; $tom = $fst + $exa + $sc ; $maya[] = $tom ; } $cal = array_sum($maya) ; //start $streamno = array(); $arresult = array() ; $myarray = array() ; //$finarray = array() ; $sqla = $DBcon->prepare("select distinct stregno from marks where (stclass =:kls and acad_session =:yr) and term = :tm" ) ; $sqla->bindparam(':kls',$classid) ; $sqla->bindparam(':yr',$schyear) ; $sqla->bindparam(':tm',$term) ; $sqla->execute() ; //$exec = mysql_query($sqla) or die('Error: ' . mysql_error()); //$row = mysql_fetch_array($exec) ; while ($streamrow = $sqla->FETCH(PDO::FETCH_ASSOC)) { $streamno[] = $streamrow['stregno']; } foreach ($streamno as $val) { $sqlgo =$DBcon->prepare("select * from marks where ((stregno = :v and stclass = :kls) and (term =:tm and acad_session = :yr)) ") ; $sqlgo->bindparam(':v',$val) ; $sqlgo->bindparam(':kls',$classid) ; $sqlgo->bindparam(':tm',$term) ; $sqlgo->bindparam(':yr',$schyear) ; $sqlgo->execute() ; //$go = mysql_query($sqlgo) or die('Error: ' . mysql_error()); //$gorow = mysql_fetch_array($go) ; $rownumber = $sqlgo->rowcount() ; while ($gorow = $sqlgo->FETCH(PDO::FETCH_ASSOC)) { $first = $gorow['test'] ; $sec = $gorow['midterm'] ; $ex = $gorow['exam'] ; $tota = $first + $ex + $sec ; $myarray[] = $tota ; //$myarray[] = $ar ; } $tosum = array_sum($myarray) ; if($rownumber < $min) $ar = $tosum/$min ; else $ar = $tosum/$rownumber; $arresult[] = $ar ; $myarray = array() ; } arsort($arresult) ; $ps = 0 ; foreach($arresult as $tot) { $ps++ ; $app = position($ps) ; if($average == $tot) { echo $ps.$app ; break ; } } ?> :   Out of:  
Principal Remarks:: Next Term Resumes::
Next Term Fees:
SCHOOL FEES ACCOUNT:
prepare("select * from pinassociate where (PINCODE = :p and TERM = :tm) and acadsession = :yr " ); $sqlp->bindparam(':p',$pin) ; $sqlp->bindparam(':tm',$term) ; $sqlp->bindparam(':yr',$schyear) ; $sqlp->execute(); if($sqlp->rowcount() > 0) { $row1 = $sqlp->FETCH(PDO::FETCH_ASSOC) ; $upin = $row1['PINCODE'] ; $owner = $row1['REGNO'] ; $numbused = $row1['NOUSED'] ; $yr = $row1['acadsession'] ; $newno = $numbused + 1 ; $updateno =$DBcon->prepare("update pinassociate set NOUSED = :n where PINCODE = :u") ; $updateno->bindparam(':n',$newno) ; $updateno->bindparam(':u',$upin) ; $updateno->execute() ; //$upchange = mysql_query($updateno) or die('Error: ' . mysql_error()); } else // this is a new pin, insert it and the student data to pin associate { $insertaso =$DBcon->prepare("insert into pinassociate(REGNO,NOUSED,PINCODE,TERM,acadsession) values(:reg,1,:p,:tm,:yr)") ; $insertaso->bindparam(':reg',$regno) ; $insertaso->bindparam(':p',$pin) ; $insertaso->bindparam(':tm',$term) ; $insertaso->bindparam(':yr',$schyear) ; $insertaso->execute() ; //$newpin = mysql_query($insertaso) or die('Error: ' . mysql_error()); }//end pin check ?>