第13行PHP注册表错误

第13行PHP注册表错误,php,syntax-error,registration,Php,Syntax Error,Registration,在过去的4个小时里,我一直在尝试修复此错误,但我失去了独自修复此错误的希望,因此我遇到了此错误: Parse error: syntax error, unexpected '||' (T_BOOLEAN_OR) in D:\xampp\htdocs\Login system\includes\signup.inc.php on line 13 怎么把它修好?我忽略了所有的地方,因为我知道在某个地方可能有一些未闭合的支架 这是我的php代码,HELP ALLERT:您以错误的方式编写了if-e

在过去的4个小时里,我一直在尝试修复此错误,但我失去了独自修复此错误的希望,因此我遇到了此错误:

Parse error: syntax error, unexpected '||' (T_BOOLEAN_OR) in D:\xampp\htdocs\Login system\includes\signup.inc.php on line 13
怎么把它修好?我忽略了所有的地方,因为我知道在某个地方可能有一些未闭合的支架


这是我的php代码,HELP ALLERT:您以错误的方式编写了if-else语句,您得到的错误来自没有打开和关闭花括号的if语句,其他语句也是如此。 试试这个:

    <?php
    include_once 'dbh.inc.php';
    if (!isset($_POST['submit'])) {
        header("Location:  ../signup.php");
        exit();
    }
    $uid = mysqli_real_escape_string($conn, $_POST['uid']);
    $pwd = mysqli_real_escape_string($conn, $_POST['pwd']);
    $email = mysqli_real_escape_string($conn, $_POST['email']);

    //Error Handlers
    //check for empty fields
    if (empty($uid) || empty(email) || empty($pwd)) {
        header("Location:  ../signup.php?signup=empty");
        exit();
    }

    if (!preg_match("/^[a-zA-Z*$/]", $uid)) {
        header("Location:  ../signup.php?signup=empty");
        exit();
    }

    if (!filter_var($email, FILTER_VALIDATE_EMAIL)){
        header("Location:  ../signup.php?signup=empty");
        exit();
    }


    if($resultCheck > 0) {
        header("Location:  ../signup.php?signup=usertaken");
        exit();
    }

    $sql = "SELECT * FROM users WHERE user_uid='$uid'";
    $result = mysql_query($conn, $sql);
    $resultCheck = mysqli_num_rows($result);

    if($resultCheck > 0) {
        header("Location:  ../signup.php?signup=usertaken");
        exit();
    }

    //Haching the password
    $hashedPwd = password_hash($pwd, PASSWORD_DEFAULT);
    //Insert the user into the database
    $sql = "INSERT INTO users (user_email, user_uid, user_pwd) VALUES ('$uid', '$email', '$hashedPwd' );";
    $result = mysqli_query($conn, $sql);
    header("Location:  ../signup.php?signup=success");
    exit();

让一切都清楚了,伙计们-这是我自己的第一个PHP代码。检查一些语法错误,如
empty(email)
你在
empty(email)
检查中缺少电子邮件前面的
$
。一些合理的代码缩进将是一个好主意。它帮助我们阅读代码,更重要的是,它将帮助您为自己的利益调试代码。您可能会被要求在几周/几个月内修改此代码,最终您会感谢我。@james是的,他们缺少括号,请查看代码,如果您感到困惑,只需将代码复制并粘贴到IDE中,我不知道您的代表是怎样的3425!haYeah,Fadi是对的,它解决了我的问题,Dave也是对的,我在电子邮件前遗漏了“$”,但现在我又遇到了一个问题。。。“找不到对象”,所以我开始看大括号,它们看起来很好,但考虑到缺少大括号的事实是代码中的一部分,在您的答案中解释这一点是有用的(确实有必要的)。而不是仅仅转储大量代码并声明“修复了它是一些大括号”,并期望人们尝试找到您修复它的位置,特别是根据错误,它不在“第13行”;)@MatasŽemaitis更新你的问题好吧,詹姆斯,对不起,我是新来的,我还不知道一切。:)
    <?php
    include_once 'dbh.inc.php';
    if (!isset($_POST['submit'])) {
        header("Location:  ../signup.php");
        exit();
    }
    $uid = mysqli_real_escape_string($conn, $_POST['uid']);
    $pwd = mysqli_real_escape_string($conn, $_POST['pwd']);
    $email = mysqli_real_escape_string($conn, $_POST['email']);

    //Error Handlers
    //check for empty fields
    if (empty($uid) || empty(email) || empty($pwd)) {
        header("Location:  ../signup.php?signup=empty");
        exit();
    }

    if (!preg_match("/^[a-zA-Z*$/]", $uid)) {
        header("Location:  ../signup.php?signup=empty");
        exit();
    }

    if (!filter_var($email, FILTER_VALIDATE_EMAIL)){
        header("Location:  ../signup.php?signup=empty");
        exit();
    }


    if($resultCheck > 0) {
        header("Location:  ../signup.php?signup=usertaken");
        exit();
    }

    $sql = "SELECT * FROM users WHERE user_uid='$uid'";
    $result = mysql_query($conn, $sql);
    $resultCheck = mysqli_num_rows($result);

    if($resultCheck > 0) {
        header("Location:  ../signup.php?signup=usertaken");
        exit();
    }

    //Haching the password
    $hashedPwd = password_hash($pwd, PASSWORD_DEFAULT);
    //Insert the user into the database
    $sql = "INSERT INTO users (user_email, user_uid, user_pwd) VALUES ('$uid', '$email', '$hashedPwd' );";
    $result = mysqli_query($conn, $sql);
    header("Location:  ../signup.php?signup=success");
    exit();