public function add(Client $client)
 {
     $q = $this->_db->prepare('INSERT INTO client SET numero = :numero, nom = :nom, prenom = :prenom, adresse= :adresse, referent = :referent');
     $q->bindValue(':numero', $client->numero(), PDO::PARAM_INT);
     $q->bindValue(':nom', $client->nom(), PDO::PARAM_STR);
     $q->bindValue(':prenom', $client->prenom(), PDO::PARAM_STR);
     $q->bindValue(':adresse', $client->adresse(), PDO::PARAM_STR);
     $q->bindValue(':referent', $client->referent(), PDO::PARAM_STR);
     $q->execute();
     return self::ACTION_REUSSIE;
 }
Example #2
0
 public function update(Client $client)
 {
     $query = $this->_db->prepare('UPDATE t_client SET nom=:nom, adresse=:adresse, telephone1=:telephone1, 
     telephone2=:telephone2, cin=:cin, email=:email WHERE id=:id') or die(print_r($this->_db->errorInfo()));
     $query->bindValue(':nom', $client->nom());
     $query->bindValue(':adresse', $client->adresse());
     $query->bindValue(':telephone1', $client->telephone1());
     $query->bindValue(':telephone2', $client->telephone2());
     $query->bindValue(':cin', $client->cin());
     $query->bindValue(':email', $client->email());
     $query->bindValue(':id', $client->id());
     $query->execute();
     $query->closeCursor();
 }