function getQuestionsByModuleForTest($Obj, $no) { $conn = getConnection(); $list = array(); $finallist = array(); $query = "SELECT * FROM question WHERE quizmodule='" . $Obj->getID() . "' AND activeflag =1 AND type=2 AND name NOT LIKE 'Quesion%' AND name NOT LIKE 'Question%' ORDER BY ID ASC"; //echo $query; $result = mysql_query($query); while ($member = mysql_fetch_array($result)) { $temp = getQuizQuestion($member['ID']); array_push($list, $temp); } if (count($list) != 0) { if (count($list) >= $no) { $rand_keys = array_rand($list, $no); } else { $rand_keys = array_rand($list, count($list)); } if (count($rand_keys) > 1) { shuffle($rand_keys); foreach ($rand_keys as $rand_keys) { array_push($finallist, $list[$rand_keys]); } } else { array_push($finallist, $list[$rand_keys]); } return $finallist; } return NULL; }
function getQuestionObj() { return getQuizQuestion($this->questionID); }
if (isset($_POST['StartQuiz'])) { $current_question = 1; } else { if (isset($_POST['Next']) && isset($_POST['NextQuestion'])) { $current_question = $_POST['NextQuestion']; if (isset($_POST['answer'])) { $prev_answer = $_POST['answer']; // write down the answer for this user somewhere } } else { ?> <!--<script> window.location = 'index.php'; </script>--> <?php } } $res = getQuizQuestion($current_question); $arr = mysqli_fetch_array($res); ?> <div class="question"> <?php echo $arr['question']; ?> </div> <div class="media"> <?php if (!empty($arr['media'])) { ?> <iframe height=100% width=100% src="<?php echo 'media/' . $arr['media']; ?> "></iframe>