Browse Source

see #5190 migrate: Undefined index: id_auto

Laurent Opprecht 12 years ago
parent
commit
634c2a7872
1 changed files with 6 additions and 4 deletions
  1. 6 4
      main/install/update-db-1.8.6.2-1.8.7.inc.php

+ 6 - 4
main/install/update-db-1.8.6.2-1.8.7.inc.php

@@ -311,10 +311,12 @@ if (defined('SYSTEM_INSTALLATION')) {
                             $sql_question = "SELECT id_auto FROM $my_course_db.quiz_answer where question_id = $question_id and id = $answer";
                             $res_question = iDatabase::query($sql_question);
                             $row = iDatabase::fetch_array($res_question);
-                            $id_auto = $row['id_auto'];
-                            if (!empty($id_auto)) {
-                                $sql = "UPDATE $dbStatsForm.track_e_attempt SET answer = '$id_auto' WHERE exe_id = $exe_id AND question_id = $question_id AND course_code = '$course_code' and answer = $answer ";
-                                iDatabase::query($sql);
+                            if($row){
+                                $id_auto = $row['id_auto'];
+                                if (!empty($id_auto)) {
+                                    $sql = "UPDATE $dbStatsForm.track_e_attempt SET answer = '$id_auto' WHERE exe_id = $exe_id AND question_id = $question_id AND course_code = '$course_code' and answer = $answer ";
+                                    iDatabase::query($sql);
+                                }
                             }
                         }
                     }