分析错误:语法错误,在C:''examplep''htdocs''quizz''serverDB.php的第159行中出现意外的'$result'(T_VARIABLE)
我搞不清楚出了什么问题>_<
<?php
$fetch="SELECT questions.question_id, questions.question, answers.answer
FROM questions
WHERE isActive=1
INNER JOIN answers
ON questions.question_id=answers.question_id ORDER BY questions.question_id;"
$result = mysql_query($fetch, $connection);
if(!$result){
die( "Database selection failed: " . mysql_error());
}
while($row = mysql_fetch_array($result)){
echo "<form method='"post'" action='"editQuestions.php'">";
echo "<tr>";
echo "<input type='"hidden'" name='"index'" value='"".$row['question_id']."'">";
for($ctrCell=1;$ctrCell<=6;$ctrCell++){
echo "<td>";
echo $row[$ctrCell];
echo "</td>";
}
echo "<td style='"border-left: solid 1px #00478F;'" class='"action'"><input type='"submit'" name='"btnAction'" value='"EDIT'"></td>";
echo "<td style='"border-right: solid 1px #00478F;'" class='"action'"><input type='"submit'" name='"btnAction'" value='"DELETE'"></td>";
echo "</tr>";
echo "</form>";
}
?>
您在$fetch
:中遗漏/放错了一个分号
$fetch="SELECT questions.question_id, questions.question, answers.answer
FROM questions
WHERE isActive=1
INNER JOIN answers
ON questions.question_id=answers.question_id ORDER BY questions.question_id;";
^ ^
$fetch="SELECT questions.question_id,questions.question,answers.answerFROM问题其中isActive=1INNER JOIN答案ON questions.question_id=answers.question_id ORDER BY questions.question_id";