public function getReserveQuestions($room_id)
 {
     $pdo = Database::getDB();
     // $number_question = 1;
     $stmt = $pdo->prepare("SELECT * FROM reserve_question WHERE room_num = ? AND difficulty = 'EASY' ORDER BY question_num ASC");
     $stmt->execute(array($room_id));
     $result = $stmt->fetchAll();
     $brain_Questions = array();
     // $remainder = $result/$number_question;
     foreach ($result as $b) {
         $brain_question = new brain_Question();
         $brain_question->setQuestion_id($b['question_id']);
         $brain_question->setQuestion_num($b['question_num']);
         $stmt = $pdo->prepare("SELECT * FROM brain_question, easy_choice WHERE brain_question.bid AND easy_choice.qid = ?");
         $stmt->execute(array($b['question_id']));
         $row = $stmt->fetch();
         $brain_question->setQuestion($row['question']);
         $brain_question->setLevel($row['level']);
         $brain_question->setSubject($row['subject']);
         $brain_question->setfile_path($row['question_path']);
         $brain_question->setHint($row['hint']);
         $brain_question->setCorrect($row['correct']);
         $brain_question->setChoiceB($row['choiceB']);
         $brain_question->setChoiceC($row['choiceC']);
         $brain_question->setChoiceD($row['choiceD']);
         $brain_Questions[] = $brain_question;
     }
     return $brain_Questions;
 }
Example #2
0
     $_SESSION['hint'] = ucwords($_POST['hint']);
     $_SESSION['correct'] = ucwords($_POST['correct']);
     $_SESSION['choiceB'] = ucwords($_POST['choiceB']);
     $_SESSION['choiceC'] = ucwords($_POST['choiceC']);
     $_SESSION['choiceD'] = ucwords($_POST['choiceD']);
     $brain_Question->setLevel($_SESSION['level']);
     $brain_Question->setSubject($_SESSION['subject']);
     $brain_Question->setQuestion($_SESSION['question']);
     $brain_Question->setHint($_SESSION['hint']);
     $brain_Question->setCorrect($_SESSION['correct']);
     $brain_Question->setChoiceB($_SESSION['choiceB']);
     $brain_Question->setChoiceC($_SESSION['choiceC']);
     $brain_Question->setChoiceD($_SESSION['choiceD']);
     $brain_Question->setfile_name($file_name = $_FILES['quest_pic']['name']);
     $brain_Question->setfile_type($file_type = $_FILES['quest_pic']['type']);
     $brain_Question->setfile_path($file_path = "./user/" . $file_name);
     move_uploaded_file($_FILES['quest_pic']['tmp_name'], $file_path);
 }
 $verified_Question = $brain_QuestionDB->verify_Question($_SESSION['question']);
 if ($verified_Question) {
     $quest = "duplicate";
 } else {
     $quest = "Added";
     $brain_QuestionDB->brain_addQuestionDB($brain_Question);
     $getBid = $brain_QuestionDB->getQid($_SESSION['question']);
     $bid = $getBid->getQid();
     $brain_Question->setQid($bid);
     $brain_QuestionDB->brain_addChoices($brain_Question);
 }
 $dup = '';
 // $category = $brain_CategoryDB->getCategory();
Example #3
0
 public function get_Question_HM($qid, $level)
 {
     $pdo = Database::getDB();
     $stmt = $pdo->prepare("SELECT * FROM brain_Question WHERE bid = ? AND level = ?");
     $stmt->execute(array($qid, $level));
     $row = $stmt->fetch();
     $brain_Question = new brain_Question();
     $brain_Question->setQid($row['bid']);
     $brain_Question->setfile_path($row['question_path']);
     $brain_Question->setSubject($row['subject']);
     $brain_Question->setLevel($row['level']);
     $brain_Question->setSubject($row['subject']);
     $brain_Question->setQuestion($row['question']);
     $brain_Question->setAnswer($row['answer']);
     $brain_Question->setHint($row['hint']);
     return $brain_Question;
 }