query("SELECT COUNT(*) FROM examscore WHERE mnumber=$up_mnumber AND exam=$up_examid AND tstamp=$up_tstamp")->fetch(PDO::FETCH_NUM)[0] == 0 ) { $db->query("DELETE FROM examscore WHERE mnumber=$up_mnumber AND exam=$up_examid"); $db->query("INSERT INTO examscore (exam,mnumber,scorestr,tstamp) values ($up_examid,$up_mnumber,\"$up_scorestr\",$up_tstamp)"); block("lightgreen", "modified submit"); } } print "
"; block("black", "summary for exam " . $EXAMS[$showexam]['timestr'] . " (" . $EXAMS[$showexam]['scorestr'] . ")"); $result = $db->query("SELECT firstname, lastname, mnumber FROM students ORDER BY LOWER(lastname)"); print "First name | Last name | Matr.nummer | Total Score | "; # if( isset($EXAMS_actual) && $showexam == $EXAMS_actual ) { # print "Blackboard | "; # } # else { # print "Modify | "; # } while ($student = $result->fetch(PDO::FETCH_ASSOC)) { $result2 = $db->query("SELECT scorestr FROM examscore WHERE mnumber=" . $student['mnumber'] . " AND exam=" . $showexam)->fetch(PDO::FETCH_NUM); $exdone = $result2[0]; if ($exdone == "") { $exdone=0; } $scorestr = $result2[0]; $totscore = 0; foreach (explode(',',$scorestr) as $points) { $totscore = $totscore + $points; } print "
" . $student['firstname'] . " | "; print "" . $student['lastname'] . " | "; print "" . $student['mnumber'] . " | "; print "" . $totscore . "/" . $EXAMS[$showexam]['totscore'] . " | "; print ""; print " |