You are here

function multichoice_clear_answer in Quiz 6.2

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

Clear an old answer. This is used for backward navigation. Before updating an answer, we have to clear old answers.

Parameters

$nid: Question node id.

$vid: Question node revision id.

$rid: Result id.

1 call to multichoice_clear_answer()
multichoice_evaluate_question in ./multichoice.module
Evaluate whether a question is correct.

File

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

Code

function multichoice_clear_answer($nid, $vid, $rid) {
  $sql = 'DELETE FROM {quiz_multichoice_user_answers} WHERE question_nid = %d AND question_vid = %d AND result_id = %d';
  $del_count = db_affected_rows(db_query($sql, $nid, $vid, $rid));

  /*
  if ($del_count > 0) {
    drupal_set_message("Your old answer has been deleted.");
  }
  */
}