I've created a simple User Verification when existing. When I run the code, I can't send it to the login.php and I've encountered this image
if (isset($_POST['addAccount'])) {
$con = connection();
$email = $_POST['email'];
$username = $_POST['username'];
$password = $_POST['password'];
$checkIfExisting = mysqli_query($con, "SELECT * FROM `admin_table` Where `username` = '$username' or `email` = '$email'");
if (!mysqli_num_rows($checkIfExisting) > 0) {
$stmt = $con->prepare("INSERT INTO `admin_table` (`email`, `username`, `password`) VALUE('$email','$username','$password')");
$stmt->execute();
header("Location : login.php");
} else {
header("Location:register.php?alert=login_failed ");
exit;
}
// $stmt = $con->prepare("INSERT INTO `admin_table` (`email`, `username`, `password`) VALUE('$email','$username','$password')");
// header("Location: login.php");
// $stmt->execute();
}
But when I return the previous code, which is the comment side and delete the checkExisting, it works .
I can successfully save the new account, but redirecting it to the login.php shows an internal error