real_escape_string($_POST["nfc"])); //print_r($sqlnfc); $result = $mysqlinfc->query($sqlnfc); //print_r($result); $user = $result->fetch_row(); print_r($user); print_r($user[0]); if ($user[0] > 0 ) { $mysqli = require __DIR__ . "/database.php"; $sql = "INSERT INTO user (name, email, password_hash, nfc) VALUES (?, ?, ?, ?)"; $stmt = $mysqli->stmt_init(); if ( ! $stmt->prepare($sql)) { die("SQL error: " . $mysqli->error); } $stmt->bind_param("ssss", $_POST["name"], $_POST["email"], $password_hash, $_POST["nfc"]); if ($stmt->execute()) { header("Location: signup-success.html"); exit; } else { if ($mysqli->errno === 1062) { die("email already taken"); } else { die($mysqli->error . " " . $mysqli->errno); } } } else { die("token not here"); } ?>