From: moodler Date: Tue, 9 Mar 2004 15:39:55 +0000 (+0000) Subject: Don't enter loop with no data ... bug 1053 X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=15ba837b5b5947287e8180ecc2dc5e90fe055893;p=moodle.git Don't enter loop with no data ... bug 1053 --- diff --git a/mod/quiz/report/fullstat/report.php b/mod/quiz/report/fullstat/report.php index 3848bbe67f..9ebd0c7670 100755 --- a/mod/quiz/report/fullstat/report.php +++ b/mod/quiz/report/fullstat/report.php @@ -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 . "\n\n"; return $tbl; } -?> \ No newline at end of file +?>