This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center。
6年前关闭。
我在下面的代码的第17行上遇到了解析错误,但是代码只有16行。我尝试重命名源文件并将其复制并粘贴到新文件中而没有任何更改。
我是PHP的新手,所以我可能缺少一些基本的知识。谢谢您的帮助。
为了避免此类错误,最好使用具有语法高亮功能的IDE。
如果您怀疑其括号不平衡,则此命令会派上用场。
如果输出为奇数,则您会得到不平衡的寄生
6年前关闭。
我在下面的代码的第17行上遇到了解析错误,但是代码只有16行。我尝试重命名源文件并将其复制并粘贴到新文件中而没有任何更改。
我是PHP的新手,所以我可能缺少一些基本的知识。谢谢您的帮助。
<?php
mysql_connect("host","username","password") or die(mysql_error());
mysql_select_db("frog") or die(mysql_error());
// Construct our join query
$query = "SELECT family.position, food.meal ".
"FROM family, food ".
"WHERE family.position = food.position";
$result = mysql_query($query) or die(mysql_error());
// Print out the contents of each row into a table
while($row = mysql_fetch_array($result)) {
echo $row['position']. " - ". $row['meal'];
echo "<br />";
?>
最佳答案
您缺少while语句}
的大括号。
while($row = mysql_fetch_array($result)) {
echo $row['position']. " - ". $row['meal'];
echo "<br />"
} // <-- This curly braces was missing
为了避免此类错误,最好使用具有语法高亮功能的IDE。
如果您怀疑其括号不平衡,则此命令会派上用场。
tr -cd '{}[]()' < source.file | wc -c
如果输出为奇数,则您会得到不平衡的寄生
关于php - 不存在的PHP解析错误在线,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/10640511/