public function MultichoiceResponse::save in Quiz 6.4
Same name and namespace in other branches
- 7.6 question_types/multichoice/multichoice.classes.inc \MultichoiceResponse::save()
- 7 question_types/multichoice/multichoice.classes.inc \MultichoiceResponse::save()
- 7.4 question_types/multichoice/multichoice.classes.inc \MultichoiceResponse::save()
- 7.5 question_types/multichoice/multichoice.classes.inc \MultichoiceResponse::save()
Implementation of save
Overrides QuizQuestionResponse::save
See also
QuizQuestionResponse#save()
File
- question_types/
multichoice/ multichoice.classes.inc, line 753 - The main classes for the multichoice question type.
Class
- MultichoiceResponse
- Extension of QuizQuestionResponse
Code
public function save() {
$sql = "INSERT INTO {quiz_multichoice_user_answers}\n (result_id, question_vid, question_nid, choice_order)\n VALUES (%d, %d, %d, '%s')";
db_query($sql, $this->rid, $this->question->vid, $this->question->nid, $this->choice_order);
$user_answer_id = db_last_insert_id('{quiz_multichoice_user_answers}', 'id');
for ($i = 0; $i < count($this->user_answer_ids); $i++) {
$sql = 'INSERT INTO {quiz_multichoice_user_answer_multi}
(user_answer_id, answer_id)
VALUES(%d, %d)';
db_query($sql, $user_answer_id, $this->user_answer_ids[$i]);
}
}