通常,T_String 错误是在有额外引号时,或者至少我认为是这样。今晚我收到了这个错误
Parse error: syntax error, unexpected T_STRING in /var/www/html/registerBackend.php on line 118
这是第 118+119 行的代码
$query = "INSERT INTO User (Name,Email,Password,Port) VALUES ('$name', '$email','$password','$port')";
mysql_query($query) or die('Error, insert query failed');
如果有帮助,这里还有一些代码
$conn = mysql_connect($dbhost, $dbuser, $dbpass) or die ('Error connecting to mysql');
$dbname ='hidden';
mysql_select_db($dbname);
//Check if Username has been used before
$query = "SELECT * FROM User where Name='$name'";
$result=mysql_query($query) or die('Error, insert query failed');
$countName=mysql_num_rows($result);
//Check if email has been used before
$query = "SELECT * FROM User where Email='$email'";
$result=mysql_query($query) or die('Error, insert query failed');
$countEmail=mysql_num_rows($result);
if($countName < 1 && $countEmail < 1){
//Assign their port number
$query = "SELECT * FROM login;
$countPort=mysql_num_rows($result);
$port = 20000 + $countPort;
$query = "INSERT INTO User (Name,Email,Password,Port) VALUES ('$name', '$email','$password','$port')";
mysql_query($query) or die('Error, insert query failed');
$query = "SELECT username, password FROM login WHERE username = '$username' AND password = '$password'";
$result = mysql_query($query);
print "<center><div id=newAREA>You have been signed up!<br>";
while($row = mysql_fetch_array($result, MYSQL_ASSOC)){
echo "Minecraft Username:{$row['Name']} <br>" .
"Email:{$row['Email']} <br>" .
"Password:{$row['Password']} <br>".
"Port:{$row['Port']} <br>";
}
} elseif ($countName > 1) {
print "Someone has already used this Minecraft IGN! E-mail Stolen@freeminecrafthost.com to prove it is yours!";
} elseif ($countEmail > 1) {
print "Email has been used before!";
}