From f34033a55dd1b5c88e04ff33790229740c2f36a1 Mon Sep 17 00:00:00 2001 From: flifloo Date: Tue, 27 Oct 2020 22:23:11 +0100 Subject: [PATCH] Category selection --- controllers/c_accueil.php | 4 ++++ languages/FR-fr.php | 2 ++ models/m_accueil.php | 16 ++++++++++++++-- views/v_accueil.php | 17 +++++++++++++++-- views/v_photo.php | 2 +- 5 files changed, 36 insertions(+), 5 deletions(-) diff --git a/controllers/c_accueil.php b/controllers/c_accueil.php index 3cd0ebc..d6a92e5 100644 --- a/controllers/c_accueil.php +++ b/controllers/c_accueil.php @@ -1,5 +1,9 @@ prepare("SELECT * FROM Photo"); - $req->execute(); + $req = null; + if ($category !== 0) { + $req = $bdd->prepare("SELECT * FROM Photo where catId = ?"); + $req->execute(array($category)); + } else { + $req = $bdd->prepare("SELECT * FROM Photo"); + $req->execute(); + } $photos = $req->fetchAll(); $req->closeCursor(); + + $req = $bdd->prepare("SELECT * FROM Categorie"); + $req->execute(); + + $categories = $req->fetchAll(); + $req->closeCursor(); } catch (Exception $e) { $alert = choixAlert("query"); } diff --git a/views/v_accueil.php b/views/v_accueil.php index ca355fe..676de5c 100644 --- a/views/v_accueil.php +++ b/views/v_accueil.php @@ -7,10 +7,23 @@ + +
+ + + +
+ +

- + + "><?= $photo['description'] ?> diff --git a/views/v_photo.php b/views/v_photo.php index 1a46c93..793d0bb 100644 --- a/views/v_photo.php +++ b/views/v_photo.php @@ -24,7 +24,7 @@ - + ">