Hi
I am trying to write code which will display a list of the questions that a student answered incorrectly in a quiz. I am writing my code in a Drupal module for my site which has Drupal / Moodle compatibility. There are various reasons, which I'm not going into, for why I'm doing this in Drupal.
I'm not sure where to look in the database, I think it's the {question_states table}. If I'm right, how do the grade and raw_grade fields work? The data in those fields doesn't appear to bear any relationship to the answers provided in a quiz attempt.
Moodle 1.9.4.
My query will be something like:
<?php
$attempt_id = db_result(db_query("SELECT quiz_attempts.uniqueid FROM quiz_attempts WHERE quiz = %d AND attempt = (SELECT MAX(attempt) FROM quiz_attempts WHERE quiz = %d AND userid = %d) AND userid = %d", $result['qid'], $result['qid'], $uid, $uid));
$incorrect = db_query("SELECT question FROM question_states WHERE attempt = %d AND raw_grade = 0", $attempt_id);
?>
Thanks
Glenn
You may want to post this question in the databases forum or quiz forum, not here.