echo '</center>';
- if (!$questions = get_records("quiz_questions", "category", $category->id, "qtype ASC")) {
+ if (!$questions = get_records("quiz_questions", "category", $category->id, "qtype ASC, name ASC")) {
echo "<p align=\"center\">";
print_string("noquestions", "quiz");
echo "</p>";
$qresults = array();
// get the list of questions for the category
- $questions = get_records("quiz_questions","category",$category->id);
+ if ($questions = get_records("quiz_questions","category",$category->id)) {
- // iterate through questions, getting stuff we need
- foreach($questions as $question) {
- $new_question = get_question_data( $question );
- $qresults[] = $new_question;
+ // iterate through questions, getting stuff we need
+ foreach($questions as $question) {
+ $new_question = get_question_data( $question );
+ $qresults[] = $new_question;
+ }
}
return $qresults;