1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54
|
if(isset($_POST['emailVerif'])){
$email=htmlspecialchars($_POST['email']);
$query=$db->query("SELECT email, nom, prenom, phone FROM clients WHERE email = '$email' ");
$count= $query->rowCount();
if($count == 1){
while($cont=$query->fetch()){
//echo $cont[1];
$cl_email=$cont['email'];
$cl_nom=$cont['nom'];
$cl_prenom=$cont['prenom'];
$cl_phone=$cont['phone'];
}
}else{ $mess='le client n\'existe pas';}
}
if(isset($_POST['action'])) {
$nom=htmlspecialchars($_POST['nom']);
$prenom=htmlspecialchars($_POST['prenom']);
$email=htmlspecialchars($_POST['email']);
$phone=htmlspecialchars($_POST['phone']);
$dateDebut =htmlspecialchars($_POST['debut']);
$dateFin =htmlspecialchars($_POST['fin']);
if(!empty($email)&& !empty($nom)&& !empty($prenom)) {
try{
require("../includes/bdd/config.php");
$query=$db->query("SELECT email, nom, prenom, phone FROM clients WHERE email = '$email' ");
$count = $query->rowCount();
if($count == 1){
//echo $nom;
//_____________________________ LE PROBLEME EST ICI
$req=(" UPDATE clients SET email='$email',phone='$phone', WHERE email=$email ");
$req->execute();
//__________________________________________________
}else{
$req=$db->prepare("INSERT INTO clients VALUES ('$email','$nom','$prenom', '$phone')");
$req->execute();
}
$req=$db->prepare("INSERT INTO reservation VALUES ('$titre', '$description','$dateDebut','$dateFin')");
$req->execute();
$msg="Evénement enregistré !";
}catch(PDOEXCEPTION $e) {
echo $e;
}
}
}
} |
Partager