while($row=mysql_fetch_array($rsChkarray,MYSQL_BOTH))
{
#calculate the results for each academic semester
mysql_select_db($database_connChePortal, $connChePortal);
$cal_Cumm= "SELECT SUM(vwr.courseUnit) cummUnit, SUM(vwr.GPP) cummGPP
FROM vw_result vwr
WHERE vwr.Grade NOT IN ('F')
AND vwr.id=".$row[0]."
AND vwr.semesterID=".$row[1].";";
$results=mysql_query($cal_Cumm, $connChePortal) or die(mysql_error());
$row_calCumm=mysql_fetch_assoc($results);
#declare the results into variables
$units= $row_calCumm['cummUnit'];
$gpp=$row_calCumm['cummGPP'];
$semesterGPA=($gpp/$units);
#cummulative results
#$cUnit=0;
$cUnit +=$units;
#$cGpp=0;
$cGpp +=$gpp;
$cGpa= ($cGpp/$cUnit);
#echo "";
#print results
if ($row[1]==$_GET['semesterID']){
echo "<p><label for='cumUnit'>
Cummulative Unit:</label>".$cUnit."</p>";
echo "<p><label for='cumPrdt'>
Cummulative GPP:</label>".$cGpp."</p>";
echo "<p><label for='cumGpa'>
Cummulative GPA:</label>".$cGpa."</p>";
}
#check URL variable for the result request
if(($row[0]==$_GET['sessionID']) &&($row[1]==$_GET['semesterID'])) break;
}