From 3f9f52f9b08ee8b5ebe6c606074ec71744670ac0 Mon Sep 17 00:00:00 2001 From: Johan LACHENAL Date: Mon, 14 Nov 2022 13:20:57 +0100 Subject: [PATCH] Envoi de la correction des includes et mise en place de toutes les gateways sauf DetalPartie --- WEB/Controller/EnigmeGateway.php | 2 ++ WEB/Controller/JoueurGateway.php | 20 +++++++++++++------- WEB/Controller/PartieGateway.php | 15 ++++++++++++--- 3 files changed, 27 insertions(+), 10 deletions(-) diff --git a/WEB/Controller/EnigmeGateway.php b/WEB/Controller/EnigmeGateway.php index 519537d5..434371d1 100644 --- a/WEB/Controller/EnigmeGateway.php +++ b/WEB/Controller/EnigmeGateway.php @@ -1,4 +1,6 @@ con = $con; } - public function insert(Joueur $joueur) : void{ + public function insert(string $email,string $pseudo,string $mdp) : void{ $query = "INSERT INTO Joueur VALUE (:email,:pseudo,:mdp)"; $this->con->executeQuery($query, array( - ':email' => array($joueur->getEmail(),PDO::PARAM_STR), - ':pseudo' => array($joueur->getPseudo(),PDO::PARAM_STR), - ':mdp' => array($joueur->getMdp(),PDO::PARAM_STR))); + ':email' => array($email,PDO::PARAM_STR), + ':pseudo' => array($pseudo,PDO::PARAM_STR), + ':mdp' => array($mdp,PDO::PARAM_STR))); + } + + public function delete(string $email) : void{ + $query = "DELETE FROM Joueur WHERE email=:email"; + $this->con->executeQuery($query, array( + ':email' => array($email,PDO::PARAM_STR) + )); } public function showAll() : void{ @@ -38,7 +45,6 @@ class JoueurGateway echo $row['email'] . '
'; echo $row['pseudo'] . '
'; echo $row['mdp'] . '
'; - echo '
'; } } diff --git a/WEB/Controller/PartieGateway.php b/WEB/Controller/PartieGateway.php index 121edb6a..6e12e73c 100644 --- a/WEB/Controller/PartieGateway.php +++ b/WEB/Controller/PartieGateway.php @@ -1,6 +1,7 @@ con = $con; } public function insert(string $idPartie){ - $query= "INSERT INTO Game VALUES ('$idPartie')"; + $query= "INSERT INTO Game VALUES (:idPartie)"; $this->con->executeQuery($query, array(':idPartie' => array($idPartie, PDO::PARAM_STR))); } public function delete(string $idPartie){ - $query= "DELETE FROM Game WHERE idGame = $idPartie"; + $query= "DELETE FROM Game WHERE idGame = :idPartie"; $this->con->executeQuery($query, array(':idPartie' => array($idPartie, PDO::PARAM_STR))); } + public function showAll() : void{ + $query= "SELECT * FROM Partie"; + $this->con->executeQuery($query); + $results=$this->con->getResults(); + foreach ($results as $row) { + echo $row['idPartie'] . '
'; + } + } } \ No newline at end of file