ich mit diesem Stück Code ein Problem bin Begegnung:php header ("Location :) verwendet zweimal Ausgabe
if (!empty($_POST['email']) && !empty($_POST['password'])
&& $_POST['password'] == $_POST['confirm_password']
&& (!filter_var ($_POST['email'], FILTER_VALIDATE_EMAIL) === false)):
//Enter the new user in the database
$sql = "INSERT INTO users (email, password) VALUE (:email, :password)";
$stmt = $conn->prepare($sql);
$stmt->bindParam(':email', $_POST['email']);
$stmt->bindParam(':password', password_hash($_POST['password'], PASSWORD_BCRYPT));
if($stmt->execute()):
header("Location:succRegister.php");
else : //this part of code is the problem
header("Location:failRegister.php");//
endif;
endif;
?>
Ich wünschte, ich wusste, warum, wenn die Anweisung ($stmt
) nicht in Bezug auf die Bedingungen ausgeführt oben, wird der Link (else
) nicht? der erste Link funktioniert.
Wie wird das Attribut 'PDO :: ATTR_ERRMODE' gesetzt? – Barmar
setzen 'exit;' nach jedem der 'header (...)' Anruf – 0x13a