You are here

function _multichoice_get_response_answers in Quiz 6.2

Same name and namespace in other branches
  1. 6.6 question_types/multichoice/multichoice.module \_multichoice_get_response_answers()
  2. 6.3 question_types/multichoice/multichoice.module \_multichoice_get_response_answers()
  3. 6.5 question_types/multichoice/multichoice.module \_multichoice_get_response_answers()

Get the user's answers for a given exam, given only the question node and the result_id. This is used to keep things checked appropriately.

1 call to _multichoice_get_response_answers()
multichoice_render_question_form in ./multichoice.module
Print question to screen.

File

./multichoice.module, line 637
Multiple choice question type for the Quiz module.

Code

function _multichoice_get_response_answers($question, $rid) {
  $answers = array();
  $sql = 'SELECT answer_id FROM {quiz_multichoice_user_answers} WHERE question_nid = %d AND question_vid = %d AND result_id = %d';
  $results = db_query($sql, $question->nid, $question->vid, $rid);
  while ($result = db_result($results)) {
    $answers[] = $result;
  }
  return $answers;
}