I'm trying to insert users into a local mysql database table but the header keeps saying stmtfailed
instead of error=name
. Any idea as to why I might be getting this issue
function createUser($conn, $name, $email, $password){
$sql = "INSERT INTO users (UserName, UserEmail, UserPassword) VALUES (?, ?, ?);";
$stmt = mysqli_stmt_init($conn);
if (!mysqli_stmt_prepare($stmt, $sql)){
header("location: ../Views/signup.php?error=stmtfailed");
exit();
}
$hashed_psw = password_hash($password, PASSWORD_DEFAULT);
mysqli_stmt_bind_param($stmt, "sss", $name, $email, $hashed_psw);
mysqli_stmt_execute($stmt);
mysqli_stmt_close();
$conn->close();
header("location: ../Views/signup.php?error=none");
exit();
}