diff --git a/includes/classes/class.question.php b/includes/classes/class.question.php index 05e0682..7d1e6d7 100755 --- a/includes/classes/class.question.php +++ b/includes/classes/class.question.php @@ -20,7 +20,7 @@ class Question extends DataItem { public static function getQuestions($count = false) { - $questions = static::getAllWhere(false, false, false, $count); + $questions = static::getAllWhere(false, "order by rand()", false, $count); foreach ($questions as $q) { $q->answers = $q->getAnswers(); shuffle($q->answers); @@ -37,4 +37,9 @@ class Question extends DataItem { { return Answer::getAllWhere("answerdata_question = ".$this->getId()); } + + public function getImage() + { + return $this->questiondata_image; + } } \ No newline at end of file diff --git a/index.php b/index.php index 6dd0bea..529d132 100755 --- a/index.php +++ b/index.php @@ -30,12 +30,18 @@ $questions = Question::getQuestions(QUESTION_COUNT); echo "".($i+1).""; echo "".$q->getQuestion().""; echo ""; + if(!empty($q->getImage())) { + echo ""; + echo "getImage())."'>"; + echo ""; + } foreach($q->answers as $x=>$ans) { echo ""; echo "".$letters[$x].""; echo "".$ans->getAnswer().""; echo ""; } + echo " "; } ?>