diff --git a/Bd/bd.sql b/Bd/bd.sql index 2db04763..2ac6dd5b 100644 --- a/Bd/bd.sql +++ b/Bd/bd.sql @@ -7,7 +7,7 @@ mdp varchar(50) CREATE TABLE Enigme( idEnigme char(5) PRIMARY KEY, admin varchar(50) REFERENCES Admin(email), -enoncé varchar(250) NOT NULL, +enonce varchar(250) NOT NULL, aide varchar(250), rappel varchar(250), solution varchar(250) NOT NULL, diff --git a/WEB/Controller/EnigmeGateway.php b/WEB/Controller/EnigmeGateway.php index 2b1c8de3..519537d5 100644 --- a/WEB/Controller/EnigmeGateway.php +++ b/WEB/Controller/EnigmeGateway.php @@ -12,17 +12,51 @@ class EnigmeGateway { $this->con = $con; } - public function insert(string $idEnigme, string $admin, string $enonce, string $aide,string $rappel,string $solution,string $test,float $tempsDeResolution){ - $query="INSERT INTO Enigme VALUES (:idEnigme,:admin,:enonce,:aide,:rappel,:solution,:test,:tempsDeResolution)"; - $this->con->executeQuery($query,array( + + public function insert(string $idEnigme, string $admin, string $enonce, string $aide, string $rappel, string $solution, string $test, float $tempsDeResolution) + { + $query = "INSERT INTO Enigme VALUES (:idEnigme,:admin,:enonce,:aide,:rappel,:solution,:test,:tempsDeResolution)"; + $this->con->executeQuery($query, array( ':idEnigme' => array($idEnigme, PDO::PARAM_STR), ':admin' => array($admin, PDO::PARAM_STR), ':enonce' => array($enonce, PDO::PARAM_STR), - ':aide'=> array($aide, PDO::PARAM_STR), - ':rappel'=> array($rappel, PDO::PARAM_STR), - ':solution'=> array($solution, PDO::PARAM_STR), - ':test'=> array($tempsDeResolution, PDO::PARAM_STR) + ':aide' => array($aide, PDO::PARAM_STR), + ':rappel' => array($rappel, PDO::PARAM_STR), + ':solution' => array($solution, PDO::PARAM_STR), + ':test' => array($tempsDeResolution, PDO::PARAM_STR) + )); + } + + public function delete(string $idEnigme) + { + $query= "DELETE FROM Enigme WHERE idEnigme=:idEnigme"; + $this->con->executequery($query, array( + ':idEnigme' => array($idEnigme,PDO::PARAM_STR) )); } + + public function findById(string $idEnigme) + { + $query="SELECT * FROM Enigme WHERE idEnigme =:idEnigme"; + $this->con->executequery($query,array( + ':idEnigme' => array($idEnigme,PDO::PARAM_STR) + )); + } + + public function showAll(): void + { + $query = "SELECT * FROM Enigme"; + $this->con->executeQuery($query); + $results = $this->con->getResults(); + foreach ($results as $row) { + echo $row['idEnigme'] . '
'; + echo $row['admin'] . '
'; + echo $row['enonce'] . '
'; + echo $row['aide'] . '
'; + echo $row['rappel'] . '
'; + echo $row['solution'] . '
'; + echo $row['test'] . '
'; + } + } } ?> \ No newline at end of file diff --git a/WEB/Controller/JoueurGateway.php b/WEB/Controller/JoueurGateway.php index f8e8be97..829653d9 100644 --- a/WEB/Controller/JoueurGateway.php +++ b/WEB/Controller/JoueurGateway.php @@ -32,13 +32,14 @@ class JoueurGateway public function showAll() : void{ $query = "SELECT * FROM Joueur"; - $this->con->executeQuery($query, array()); + $this->con->executeQuery($query); $results=$this->con->getResults(); - foreach ($results as $row) + foreach ($results as $row) { echo $row['email'] . '
'; echo $row['pseudo'] . '
'; echo $row['mdp'] . '
'; echo '
'; + } } } \ No newline at end of file