|
|
|
@ -8,16 +8,18 @@ use PDO;
|
|
|
|
|
class QuizGateway extends Gateway
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
public function create(int $id_quiz, int $nb_questions) : bool
|
|
|
|
|
public function create(int $id_quiz, int $nb_questions, string $id_img, string $title) : bool
|
|
|
|
|
{
|
|
|
|
|
$query = "
|
|
|
|
|
INSERT INTO Quiz
|
|
|
|
|
VALUES (:id_q, :nb_q)
|
|
|
|
|
VALUES (:id_q, :nb_q, :id_img, :title)
|
|
|
|
|
";
|
|
|
|
|
|
|
|
|
|
return $this -> co -> executeQuery($query, [
|
|
|
|
|
':id_q' => array($id_quiz, PDO::PARAM_INT),
|
|
|
|
|
':nb_q' => array($nb_questions, PDO::PARAM_INT)
|
|
|
|
|
':nb_q' => array($nb_questions, PDO::PARAM_INT),
|
|
|
|
|
':id_img' => array($id_img, PDO::PARAM_STR),
|
|
|
|
|
':title' => array($title, PDO::PARAM_STR)
|
|
|
|
|
]);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -36,7 +38,7 @@ class QuizGateway extends Gateway
|
|
|
|
|
|
|
|
|
|
public function findAll() : array
|
|
|
|
|
{
|
|
|
|
|
$query = "SELECT id_quiz, title, imgPath FROM Quiz q JOIN Image i on q.img = i.id_img";
|
|
|
|
|
$query = "SELECT id_quiz, title, imgPath, nb_quest FROM Quiz q JOIN Image i on q.img = i.id_img";
|
|
|
|
|
$this -> co -> executeQuery($query);
|
|
|
|
|
return $this -> co -> getResults();
|
|
|
|
|
}
|
|
|
|
|