ServeurDeTest
Noé GARNIER 2 years ago
parent 8552562ba8
commit 18e8a8d5c4

@ -175,6 +175,9 @@ class EnigmeGateway
$query = "SELECT * FROM Enigme WHERE ordre = 0 ORDER BY RANDOM() LIMIT 1";
$this->con->executequery($query);
$results = $this->con->getResults();
if (empty($results)){
throw new Exception("Aucune énigme mulitijoeur n'est disponible");
}
$tabEnigme=EnigmeFactory::create($results);
return $tabEnigme[0];
}

@ -251,12 +251,14 @@ class PartieGateway
throw new Exception("La partie est pleine");
}
if ($player + 1 == $playerNumberPerGame) {
echo "La partie est pleine";
$query = "INSERT INTO Participer VALUES (:partie,:utilisateur,1)";
$this->con->executeQuery($query, array(
"partie" => array($idPartie, SQLITE3_INTEGER),
"utilisateur" => array($mailUtilisateur, SQLITE3_TEXT)));
}
else {
echo "La partie n'est pas pleine";
$query = "INSERT INTO Participer VALUES (:partie,:utilisateur,0)";
$this->con->executeQuery($query, array(
"partie" => array($idPartie, SQLITE3_INTEGER),

Loading…
Cancel
Save