コード例 #1
0
function UpdateQuestionInfo($paperName, $questionNum, $questionInfo, $questionType, $questionSelect, $questionScore)
{
    include_once '../DAL/questionDal.php';
    $questionID = GetQuestionID($paperName, $questionNum);
    UpdateQuestion($questionID, $questionNum, $questionInfo, $questionType, $questionSelect, $questionScore);
    return 1;
}
コード例 #2
0
ファイル: question.php プロジェクト: Arnavel/quiz
function getQuestion($id = 0)
{
    $question_array = UpdateQuestion();
    $one_question = $question_array[$id];
    if ($_SESSION['givenQuestions'] == null) {
        $_SESSION['givenQuestions'] = [];
    }
    if (count($_SESSION['givenQuestions']) === count($question_array)) {
        return false;
    }
    if (array_search($id, $_SESSION['givenQuestions']) !== false) {
        $id++;
        return getQuestion($id);
    } else {
        $_SESSION['givenQuestions'][] = $id;
        $correct = $one_question['answers'][0];
        shuffle($one_question['answers']);
        $_SESSION['answer'] = array_search($correct, $one_question['answers']);
        return $one_question;
    }
}