Assuming a student takes 6 courses per semester. All of these yards have units of slope (int), and depending on the grade in each course there are points.
so a score >=70 will have a point of 5 <70 and >=60 will have a ponit of 4
etc. For each unit of course, points are multiplied together, down the column for each column. Now that the course grade is not found, class "AR". Now I want the loops to omit the appearance of AR..ie without adding a course unit that has a grade of "AR". But when I start my queries over units, I still add to the general units of the course.
Query4 is used to create multiple course_unit and grade lines .
$query4 = mysql_query("SELECT c.course_unit, m.score FROM maintable AS m INNER JOIN students AS s ON m.matric_no = s.matric_no INNER JOIN courses AS c ON m.course_code = c.course_code WHERE m.matric_no = '".$matric_no."' AND m.level = '".$level."'") or die (mysql_error());
Query3 is used to summarize course_units
$query3 = mysql_query("SELECT SUM(c. course_unit) AS 'TOTAL' FROM maintable AS m INNER JOIN students AS s ON m.matric_no = s.matric_no INNER JOIN courses AS c ON m.course_code = c.course_code WHERE m.matric_no = '".$matric_no."' AND m.level = '".$level."'") or die (mysql_error());
Grades in relation to grades
while ($row8 = mysql_fetch_assoc ($query8)) { if ($row8['score'] >= 70) { $grade = 'A'; } elseif ($row8['score'] >= 60) { $grade = 'B'; }elseif ($row8['score'] >= 50) { $grade = 'C'; }elseif ($row8['score'] >= 45) { $grade = 'D'; }elseif($row8['score'] >= 40) { $grade = 'E'; }elseif($row8['score'] >= 0) && ($row8['score'] < 40){ $grade = 'F'; }else{ $grade = 'AR'; } }
Assessment Point Calculation
$grade_point = 0; while ($row4 = mysql_fetch_assoc($query4)) { if ($row4['score'] >= 70) { $score = 5; } elseif ($row4['score'] >= 60) { $score = 4; }elseif ($row4['score'] >= 50) { $score = 3; }elseif ($row4['score'] >= 45) { $score = 2; }elseif($row4['score'] >= 40) { $score = 1; }elseif($row4['score'] >= 0 AND $row4['score'] < 40) { $score = 0; }else{ $score = 0; } $grade_point += $score * $row4['course_unit']; }
I added
if ( $grade == 'AR' ) { continue; }
But the calculations are the same. It adds a course_unit value to any course that has
$grade == 'AR' .
I will be delighted with your answers. Many thanks.
UPDATE
I can solve part of the piont class by adding
elseif($row4['score'] >= 0 AND $row4['score'] < 40) { $score = 0; }else{ $score = 0; }
This sets both scores between 0 and 39 to zero, and the default score <0 (i.e. AR) to zero. But it still sets the value of courses with an AR score of -1 and defaults to the corresponding course_nit values.
I think this problem occurs because cursor_unit is preloaded from the database. Any help?
Courses Table Stucture
I will be very happy for your answers. Thank you pending.