diff --git a/public/main/exercise/answer.class.php b/public/main/exercise/answer.class.php index da82f74e1f..448c15d655 100644 --- a/public/main/exercise/answer.class.php +++ b/public/main/exercise/answer.class.php @@ -785,17 +785,14 @@ class Answer if (count($this->position) > $this->new_nbrAnswers) { $i = $this->new_nbrAnswers + 1; - if (isset($this->position[$i])) { - while ($this->position[$i]) { - $position = $this->position[$i]; - $sql = "DELETE FROM $answerTable - WHERE - c_id = {$this->course_id} AND - question_id = '".$questionId."' AND - position ='$position'"; - Database::query($sql); - $i++; - } + while (isset($this->position[$i])) { + $position = $this->position[$i]; + $sql = "DELETE FROM $answerTable + WHERE + question_id = '".$questionId."' AND + position ='$position'"; + Database::query($sql); + $i++; } }