コード例 #1
0
 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;
 }
コード例 #2
0
ファイル: index.php プロジェクト: Jheysoon/brainwave
 $user_id = $brain_users->getUser_id();
 $level = 'Easy';
 $locator = $_POST['locator'];
 $_SESSION['level'] = $level;
 if (empty($file_name)) {
     $_SESSION['subject'] = ucwords($_POST['subject']);
     $_SESSION['question'] = ucwords($_POST['question']);
     $_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']);
 } else {
     $_SESSION['subject'] = $_POST['subject'];
     $_SESSION['question'] = ucwords($_POST['question']);
     $_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']);
コード例 #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;
 }