Example #1
0
 function sauvegarder(Membre $membre)
 {
     $dbh = $this->_db;
     $sql = "INSERT INTO Membre (nom, prenom, mdp, email) VALUES (:nom, :prenom, :mdp, :email);";
     $sth = $dbh->prepare($sql);
     $sth->bindParam(":nom", $membre->nom(), PDO::PARAM_STR);
     $sth->bindParam(":prenom", $membre->prenom(), PDO::PARAM_STR);
     $sth->bindParam(":mdp", $membre->mdp(), PDO::PARAM_STR);
     $sth->bindParam(":email", $membre->email(), PDO::PARAM_STR);
     if ($sth->execute() == 0) {
         print $dbh->errorInfo();
         // affiche message d'érreur de la bdd
     } else {
         $noMem = $dbh->lastInsertId();
         $membre->setNoMem($noMem);
     }
 }