Advertisement
Guest User

Untitled

a guest
May 24th, 2015
226
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. function add_user($nom,$prenom,$email){
  3.  
  4.     $stmt = $GLOBALS['bdd']->prepare("SELECT email FROM users WHERE email=:email");
  5.     $stmt->execute(array(':email'=>$email));
  6.  
  7.     if($stmt->rowCount() == 0){
  8.         $rsp = $GLOBALS['bdd']->prepare("INSERT INTO users(nom,prenom,email) VALUES(:nom,:prenom,:email)");
  9.         $rsp->execute(array(
  10.             ':nom' => $nom,
  11.             ':prenom' => $prenom,
  12.             ':email' => $email
  13.             ));
  14.  
  15.         return true;
  16.     }else{
  17.         return false;
  18.     }
  19.  
  20.  
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement