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 @@ - + ">