-1

What's wrong in my code ? it says that my error is ";" where die ("Your account has been created and you are logged on!"); <----- tha's the error, can you help me, it seems theirs more error beside the semicolon but i can't find and think of what is it.Btw this is my signup. heres the code:

<?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>
Your Common Sense
  • 156,878
  • 40
  • 214
  • 345
japjap
  • 25
  • 1
  • 1
  • 7
  • missing `)` at `if (mysqli_query($conn,$insert){` – Saty Mar 10 '16 at 11:35
  • thanks,can i ask a follow-up question ? i dont know what "charset" is, and the manual says that I need to identify what type my program uses, like utf16 utf8, how should know this ? thanks – japjap Mar 11 '16 at 03:07

1 Answers1

0

You're missing a closing parenthesis here:

if (mysqli_query($conn,$insert)) {
-------------------------------^
Ankh
  • 5,478
  • 3
  • 36
  • 40