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 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92
| <?php
class Personne {
private $id;
private $nom;
private $prenom;
private $date_naissance;
private $adresse;
private $cote_postal;
private $ville;
private $tel_portable;
private $tel_fixe;
private $email;
private $numero_secu;
private $statut_matrimonial;
public function getId() { return $this->id; }
public function getNom() { return $this->nom; }
public function getPrenom() { return $this->prenom; }
public function getDate_naissance() { return $this->date_naissance; }
public function getAdresse() { return $this->adresse; }
public function getCote_postal() { return $this->cote_postal; }
public function getVille() { return $this->ville; }
public function getTel_portable() { return $this->tel_portable; }
public function getTel_fixe() { return $this->tel_fixe; }
public function getEmail() { return $this->email; }
public function getNumero_secu() { return $this->numero_secu; }
public function getStatut_matrimonial() { return $this->statut_matrimonial; }
public function setId($x) { $this->id = $x; }
public function setNom($x) { $this->nom = $x; }
public function setPrenom($x) { $this->prenom = $x; }
public function setDate_naissance($x) { $this->date_naissance = $x; }
public function setAdresse($x) { $this->adresse = $x; }
public function setCote_postal($x) { $this->cote_postal = $x; }
public function setVille($x) { $this->ville = $x; }
public function setTel_portable($x) { $this->tel_portable = $x; }
public function setTel_fixe($x) { $this->tel_fixe = $x; }
public function setEmail($x) { $this->email = $x; }
public function setNumero_secu($x) { $this->numero_secu = $x; }
public function setStatut_matrimonial($x) { $this->statut_matrimonial = $x; }
public function __tostring() {
return "Cette classe permet de définir et manipuler une personne.<br/>";
}
function __construct($nom, $prenom, $date_naissance, $adresse, $cote_postal, $ville, $tel_portable, $tel_fixe , $email, $numero_secu, $statut_matrimonial) {
$this->nom = $nom;
$this->prenom = $prenom;
$this->date_naissance = $date_naissance;
$this->adresse = $adresse;
$this->code_postal = $cote_postal;
$this->ville = $ville;
$this->tel_portable = $tel_portable;
$this->tel_fixe = $tel_fixe;
$this->email = $email;
$this->numero_secu = $numero_secu;
$this->statut_matrimonial = $statut_matrimonial;
}
public function insert(){
$sql = "insert into personnes (nom, prenom, date_naissance, adresse, code_postal, ville, tel_portable, tel_fixe, numero_secu,
statut_matrimonial, email) values
('".$this->nom."', '".$this->prenom."', '".$this->date_naissance."', '".$this->adresse."', '".$this->code_postal."', '".$this->ville."',
'".$this->tel_portable."', '".$this->tel_fixe."', '".$this->numero_secu."', '".$this->statut_matrimonial."', '".$this->email."')";
$query = mysql_query($sql);
}
public function update(){
$sql = "UPDATE personnes SET nom = '$this->nom' , prenom = '$this->prenom' , date_naissance = '$this->date_naissance' , adresse = '$this->adresse' , code_postal = '$this->code_postal' , ville = '$this->ville' ,tel_portable = '$this->tel_portable' , tel_fixe = '$this->tel_fixe' , statut_matrimonial = '$this->statut_matrimonial' , numero_secu = '$this->numero_secu' WHERE id = '$this->id'" ;
echo $sql;
$query = mysql_query($sql);
}
public function delete() {
$sql = "DELETE FROM personnes WHERE id = '$this->id'";
$query = mysql_query($sql);
}
}
?> |