解析错误:语法错误,意外';'在第42行的C:\ xampp \ htdocs \ gs4 \ signup.php中

时间:2016-03-10 11:33:43

标签: php syntax-error

我的代码有什么问题?它说我的错误是“;”哪里死(“你的帐户已经创建,你登录了!”); < -----这是错误,你可以帮助我,看起来他们的分号旁边有更多的错误,但是我找不到并想到它是什么。这是我的注册。继承人代码:

<?php
$servername = "localhost";
$username = "root";
$password = "crazyjaguar";
$db = "getstarted";

// Create connection
$conn = mysqli_connect($servername, $username, $password, $db);

// Check connection
if (!$conn) {
    die("Connection failed: " . mysqli_connect_error());
}
//echo "Connected successfully";

if ($_SERVER["REQUEST_METHOD"] == "POST") {
//  error_reporting(0);
    if ($_POST['email'] && $_POST['pwd'] && $_POST['nickname']) {

            $email = mysqli_real_escape_string($conn, $_POST['email']);
            $password = mysqli_real_escape_string($conn, $_POST['pwd']);
            $nickname = '';
                if ($_POST['nickname']) {

                    $nickname = mysqli_real_escape_string($conn, $_POST['nickname']);
                }

                $check = "SELECT email, password FROM gs_users";

                if ($check != 0) {

                    die ("Email is already exists.");
                }

                $insert = "INSERT INTO gs_users (email, password, nickname) VALUES ('$email', '$password', '$nickname')";

                if (mysqli_query($conn,$insert){
                    //setcookie("c_user", hash("sha512", $email), time() + 24 * 60 * 60, "/");

                    die ("Your account has been created and you are logged on!");
}   
}
}

?>

<body>
<h1>Sign Up</h1>

<form action='' method='post'>

<input type='text' name='nickname' placeholder='Nickname'><br />
<input type='email' name='email' placeholder='Email'><br />
<input type='password' name='pwd' placeholder='Password'><br />
<input type='submit' name='signup' value='Signup Here!'><br />
<a href='forgot.php'>Forgost Password?</a><br />


</form>
</body>

1 个答案:

答案 0 :(得分:0)

你在这里错过了一个右括号:

if (mysqli_query($conn,$insert)) {
-------------------------------^