Beispiel #1
0
            $class = 'row1';
        } else {
            $class = 'row2';
        }
        $i += 1;
        ?>
<tr class="<?php 
        echo $class;
        ?>
">
<td align="center"><?php 
        echo $subject_name;
        ?>
 </td>
<?php 
        $gradeTable = gradeTable($subject_id);
        $subjectAnalysis_ = new subjectAnalysis();
        $query = "SELECT grade from grades";
        $query_result = mysql_query($query);
        while ($row_query = mysql_fetch_assoc($query_result)) {
            extract($row_query);
            $grade_count = $subjectAnalysis_->countGrade($subject_id, $grade, $term_id, $class_id, $gradeTable);
            $i += 1;
            ?>
<td align="center"><?php 
            echo $grade_count;
            ?>
</td>
<?php 
        }
        $gradeTable = 'grades';
Beispiel #2
0
 function averageGrade($term_id, $stud_id, $subject_id)
 {
     $gradeTable = gradeTable($subject_id);
     $query = "SELECT (cat_1+cat_2+mid_term+end_term)/4 AS averageE,grade AS gradeE\n\t\tFROM student_marks,{$gradeTable},subject\n\t\tWHERE (cat_1+cat_2+mid_term+end_term)/4<=max_mark AND (cat_1+cat_2+mid_term+end_term)/4>=min_mark\n\t\tAND subject.subject_id=student_marks.subject_id AND subject.subject_id='{$subject_id}' AND term_id='{$term_id}' and student_marks.stud_id='{$stud_id}'";
     $result = mysql_query($query) or die(mysql_error());
     if (mysql_num_rows($result) > 0) {
         $row1 = mysql_fetch_assoc($result);
         extract($row1);
     } else {
         $averageE = '0.00';
         $gradeE = '--';
     }
     return array('key1' => $averageE, 'key2' => $gradeE);
 }