php 解析错误:语法错误,意外的“$query”(T_VARIABLE)

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/15764821/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-25 09:55:23  来源:igfitidea点击:

Parse error: syntax error, unexpected '$query' (T_VARIABLE)

phpmysql

提问by BenniMcBeno

Evening all,

晚上大家,

I am having an issue with this script and i'm hoping one of you fine programmers could let me know where the error is.

我遇到了这个脚本的问题,我希望你们中的一位优秀的程序员可以让我知道错误在哪里。

<?php

mysql_connect("127.0.0.1", "root", "") or die (mysql_error());
echo "Connected to MYSQL ";
mysql_select_db("tutorial") or die (mysql_error());
echo "Connected to Data Base"
$query = "SELECT * FROM forr1";
$result = mysql_query ($query) or die (mysql_error());
while ($row = mysql_fetch_array($result)) {
        echo $row['input1'];


?>

The Output

输出

Parse error: syntax error, unexpected '$query' (T_VARIABLE) in C:\Program Files (x86)\EasyPHP-12.1\www\Output.php on line 7

I must be missing something significant because no matter how i try and rework it i get the same error.

我一定遗漏了一些重要的东西,因为无论我如何尝试和返工,我都会遇到同样的错误。

Thanks for your time

谢谢你的时间

Ben

回答by Grant Thomas

Missing semi-colon on the line prior:

前一行缺少分号:

echo "Connected to Data Base"

Terminate the statement:

终止声明:

echo "Connected to Data Base";