From 83d0fa75af2c68b70974ec15f9ab90c8c0af8428 Mon Sep 17 00:00:00 2001 From: Matthieu Guffroy <mattgu74@gmail.com> Date: Wed, 18 Jun 2014 00:46:29 +0200 Subject: [PATCH] ok for insert sql --- class/employe.php | 20 ++++++++++---------- class/objet.php | 10 ++-------- controller/personne.php | 4 ++-- 3 files changed, 14 insertions(+), 20 deletions(-) diff --git a/class/employe.php b/class/employe.php index eeaca30..3602ee5 100644 --- a/class/employe.php +++ b/class/employe.php @@ -2,26 +2,26 @@ class Employe extends Personne { - protected $idNational; - protected $isVeterinaire; + protected $id_national; + protected $is_veterinaire; - public function idNational() + public function id_national() { - return $this->idNational; + return $this->id_national; } - public function setIdNational($idNational) + public function setId_national($id_national) { - $this->idNational = $idNational; + $this->id_national = $id_national; } - public function isVeterinaire() + public function is_veterinaire() { - return $this->isVeterinaire; + return $this->is_veterinaire; } - public function setIsVeterinaire($isVeterinaire) + public function setIs_veterinaire($isVeterinaire) { - $this->isVeterinaire = $isVeterinaire; + $this->is_veterinaire = $isVeterinaire; } } \ No newline at end of file diff --git a/class/objet.php b/class/objet.php index 149d5a3..5f5646a 100644 --- a/class/objet.php +++ b/class/objet.php @@ -74,14 +74,8 @@ class Objet $params[$keyName] = $this->$keyName; } - //$req = "INSERT INTO ".$dbName." (".implode(",", array_keys($values)).") - //VALUES (".implode(",", array_values($values)).")"; - $req = "INSERT INTO client (id,nom,prenom,num_tel) VALUES (nextval('client_id_seq'::regclass), :nom, :prenom, :num_tel)"; - - - //debug - //echo $req; - //die(); + $req = "INSERT INTO ".$dbName." (".implode(",", array_keys($values)).") + VALUES (".implode(",", array_values($values)).")"; $requete_prepare = $bdd->db->prepare($req); // on prépare notre requête diff --git a/controller/personne.php b/controller/personne.php index cb85664..e53814d 100644 --- a/controller/personne.php +++ b/controller/personne.php @@ -15,14 +15,14 @@ switch($action) { case "listePersonnel": $listArray = Employe::getAll(); $listParams = array("title" => "Liste du personnel", - "keys" => array("id", "nom", "prenom", "isVeterinaire", "idNational")); + "keys" => array("id", "nom", "prenom", "is_veterinaire", "id_national")); $editLink = "editPersonnel"; include 'view/list.php'; break; case "listeClient": $listArray = Client::getAll(); $listParams = array("title" => "Liste des clients", - "keys" => array("id", "nom", "prenom", "numTel")); + "keys" => array("id", "nom", "prenom", "num_tel")); $editLink = "editClient"; include 'view/list.php'; break; -- GitLab