解析错误:语法错误,意外';'在第11行,我试图找出我的错误,但没有成功。当我按照教程,代码是1/1视频,我不明白有什么问题。我在PHP初学者级别,所以任何人都可以帮助解决这个问题吗?
<?php
if (isset($_POST['submit'])) {
include_once 'dbh.inc.php';
$first = mysql_real_escape_string($conn, $_POST['first']);
$mail = mysql_real_es1cape_string($conn, $_POST['mail']);
$pwd = mysql_real_escape_string($conn, $_POST['pwd']);
if (empty($first)||(empty($mail)||(empty($pwd)) {
header("Location: signup.php?signup=empty");
exit();
}
else {
if (!preg_match("/^[a-zA-Z]*$/", $first)){
header("Location: ../index.html?signup=invalid");
exit();
} else {
if (filter_var($mail, FILTER_VALIDATE_EMAIL)){
header("Location: ../index.html?signup=empty");
exit();
} else {
$sql = "SELECT * FROM users WHERE users_mail='$mail'";
$result = mysql_query($conn, $sql);
$resultCheck = mysql_num_rows($results);
if($resultCheck > 0) {
header("Location: ../index.html?signup=emailalredyinuse");
exit();
} else {
$hashedPWD = pasword_hash($pwd, PASWORD_DEFAULT);
$sql = "INSERT INTO users (user_first, user_mail, User_pwd) VALUES ('$first', '$mail', '$hashedPWD');";
$result = mysql_query($conn, $sql);
header("Location: ../index.html?signup=succsess");
exit();
}
}
}
}
} else {
header("Location: ../index.html");
exit();
}
答案 0 :(得分:0)
if语句中有错误,这一行:
if (empty($first)||(empty($mail)||(empty($pwd)) {
应该是:
if (empty($first)||empty($mail)||empty($pwd)) {