'.$row['title'].'
'; //get all the questions in this test, store them $sql = "SELECT TQ.*, TQA.* FROM ".TABLE_PREFIX."tests_questions TQ INNER JOIN ".TABLE_PREFIX."tests_questions_assoc TQA USING (question_id) WHERE TQ.course_id=$_SESSION[course_id] AND TQA.test_id=$tid ORDER BY TQA.ordering, TQA.question_id"; $result = mysql_query($sql, $db); $questions = array(); while ($row = mysql_fetch_assoc($result)) { $questions[$row['question_id']] = $row; } $long_qs = substr($long_qs, 0, -1); //get the answers: count | q_id | answer $sql = "SELECT count(*), A.question_id, A.answer, A.score FROM ".TABLE_PREFIX."tests_answers A, ".TABLE_PREFIX."tests_results R WHERE R.status=1 AND R.result_id=A.result_id AND R.final_score<>'' AND R.test_id=$tid"; if ($_POST["user_type"] == 1) $sql .= " AND R.member_id not like 'G_%' AND R.member_id > 0 "; if ($_POST["user_type"] == 2) $sql .= " AND (R.member_id like 'G_%' OR R.member_id = 0) "; $sql .= " GROUP BY A.question_id, A.answer ORDER BY A.question_id, A.answer"; $result = mysql_query($sql, $db); ?>

/> /> />
- '._AT('correct_answer').'

'; $ans = array(); while ($row = mysql_fetch_assoc($result)) { $ans[$row['question_id']][$row['answer']] = array('count'=>$row['count(*)'], 'score'=>$row['score']); } //print out rows foreach ($questions as $q_id => $q) { /* for random: num_results is going to be specific to each question. * This is a randomized test which means that it is possible each question has been answered a * different number of times. Statistics are therefore based on the number of times each * question was answered, not the number of times the test has been taken. */ //catch random unanswered if($ans[$q_id]) { $obj = TestQuestions::getQuestion($q['type']); $obj->displayResultStatistics($q, $ans[$q_id]); } } require(AT_INCLUDE_PATH.'footer.inc.php'); ?>