PHP - 解析错误:语法错误,意外的文件结束,期望变量

时间:2017-04-29 10:36:16

标签: php syntax syntax-error

尝试运行我的代码时,我总是遇到以下错误:

(!)解析错误:第33行上的/var/www/test/messe/RegisterEvent.php中的语法错误,文件意外结束,期望变量(T_VARIABLE)或$ {(T_DOLLAR_OPEN_CURLY_BRACES)或{$(T_CURLY_OPEN)

这是我的代码:

<?php
$link = mysqli_connect("localhost","root","password")  or die("connection FAIL!");
mysqli_select_db($link,"messe");
if(isset($_REQUEST['submit']))
{
$errorMessage = "connection FAIL!";
$company=$_POST['company'];
$firstname=$_POST['firstname'];
$surname=$_POST['surname'];
$address=$_POST['address'];
$city=$_POST['city'];
$zipcode=$_POST['zipcode'];
$phone=$_POST['phone'];
$email=$_POST['email'];
$reason=$_POST['reason'];
$remarks=$_POST['remarks'];
$newsletter=$_POST['newsletter'];

if ($errorMessage != "" ) {
echo "<p class='message'>" .$errorMessage. "</p>";
}
else{
$insqDbtb="INSERT INTO `messe`.`members`
(`company`, `firstname`, `surname`, `address`, `city`, `zipcode`, `phone`, `email`, `reason`, `remarks`, `newsletter`) VALUES ('$company', '$firstname', '$surname', '$address', '$address', '$city', '$zipcode', '$phone', '$email', '$reason', '$remarks', '$newsletter')";
mysqli_query($link,$insqDbtb) or die(mysqli_error($link));
echo "<meta http-equiv='refresh' content=\"0; url=register.html">";
}
}
?>

我已经检查了50次我的代码,但是我找不到语法错误。在线语法检查器也告诉我我的代码很好。

提前致谢!

1 个答案:

答案 0 :(得分:0)

你有一个黑色斜线“它没有完成正确的陈述,请尝试改变

echo "<meta http-equiv='refresh' content=\"0; url=register.html">";

echo "<meta http-equiv='refresh' content='0; url=register.html'>";