1

次のようなエラーが表示されます。

解析エラー:構文エラー、599行目の....の予期しないT_VARIABLE

これは以下の行に属します:

foreach ($questions as $key=>$question) {

    echo '<p><strong>Question:</strong> ' .htmlspecialchars($row_question['question_num'][$key]). ': ' .htmlspecialchars($row_question['question_content']$key]). '</p>' . PHP_EOL;

    }

私は間違って何をしていますか?

以下はコードです:

    $question = array();

    while ($selectedstudentanswerstmt->fetch()) {

    $row_question = array();
    $row_question['question_num'] = $detailsQuestionNo;
    $row_question['question_content'] = $detailsQuestionContent;
    $row_question['question_option'] = $detailsOptionType;
    $row_question['question_num_answers'] = $detailsNoofAnswers;
    $row_question['question_answer'] = $detailsAnswer;
    $row_question['questionnum_reply'] = $detailsReplyType;
    $row_question['questionnum_marks'] = $detailsQuestionMarks;
    $questions[] = $row_question;
}

.................

<?php   

          foreach ($questions as $key=>$question) {

echo '<p><strong>Question:</strong> ' .htmlspecialchars($row_question['question_num'][$key]). ': ' .htmlspecialchars($row_question['question_content']$key]). '</p>' . PHP_EOL;

}
?>
4

1 に答える 1

3

ブラケットがありません

    echo '<p><strong>Question:</strong> ' .htmlspecialchars($row_question['question_num'][$key]). ': ' .htmlspecialchars($row_question['question_content']$key]). '</p>' . PHP_EOL;

する必要があります

    echo '<p><strong>Question:</strong> ' .htmlspecialchars($row_question['question_num'][$key]). ': ' .htmlspecialchars($row_question['question_content'][$key]). '</p>' . PHP_EOL;
于 2013-02-06T02:39:38.930 に答える