]> git.mjollnir.org Git - moodle.git/commitdiff
Don't enter loop with no data ... bug 1053
authormoodler <moodler>
Tue, 9 Mar 2004 15:39:55 +0000 (15:39 +0000)
committermoodler <moodler>
Tue, 9 Mar 2004 15:39:55 +0000 (15:39 +0000)
mod/quiz/report/fullstat/report.php

index 3848bbe67fda50527ced957e89d0d6c001b4b8f8..9ebd0c7670207e91408a86c0b1c26e3cd46d23af 100755 (executable)
@@ -40,10 +40,11 @@ class quiz_report extends quiz_default_report {
     foreach ($qs_in_order as $qid){
         $table_colcount++;
         //Get the question type and text and append to object
-        $question_data = get_records_select("quiz_questions",$select="id='$qid'","","qtype,questiontext");
-        foreach($question_data as $thiskey => $thisq){
-            $quests[$qid]["qtype"] =  $thiskey;
-            $quests[$qid]["qtext"] =  $question_data[$thiskey]->questiontext;
+        if ($question_data = get_records_select("quiz_questions",$select="id='$qid'","","qtype,questiontext")) {
+            foreach($question_data as $thiskey => $thisq){
+                $quests[$qid]["qtype"] =  $thiskey;
+                $quests[$qid]["qtext"] =  $question_data[$thiskey]->questiontext;
+            }
         }
         if($quests[$qid]['qtype'] == 3 or $quests[$qid]['qtype'] == 2){ $containsMCTF = 1;}
         if($quests[$qid]['qtype'] == 5){
@@ -1026,4 +1027,4 @@ function qr_match_table($resplist){
     $tbl = $tbl . "</tr>\n</table>\n";
     return $tbl;
 }
-?>
\ No newline at end of file
+?>