From 3690949a7e3af04c34e15c7cbbb7e0a3bde3d10e Mon Sep 17 00:00:00 2001 From: Jan BELLON Date: Fri, 8 Mar 2024 15:46:17 +0000 Subject: [PATCH] Update file news.php --- html/news.php | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/html/news.php b/html/news.php index 4932eba7..2461584c 100644 --- a/html/news.php +++ b/html/news.php @@ -51,23 +51,20 @@ if (filter_var($_GET['article'], FILTER_VALIDATE_INT)) { require_once '../include/parsedown.php'; $parsedown = new Parsedown(); echo "
"; - bdd = connect($dbhost, $dbname, $dbuser, $dbpass); - $req = $bdd->prepare("SELECT ID, titre, date, auteur, classification FROM articles WHERE classification <= :accreditation ORDER BY date DESC"); - $req->bindParam(":accreditation", $_SESSION['accreditation']); + $bdd = connect($dbhost, $dbname, $dbuser, $dbpass); + $req = $bdd->prepare("SELECT ID, titre, date, auteur, classification FROM articles WHERE ID = :article"); + $req->bindParam(":article", $article); $req->execute(); - $resultat = $req->fetchAll(PDO::FETCH_ASSOC); - - $date = new Datetime($row['date']); + $resultat = $req->fetchAll(PDO::FETCH_ASSOC);; if ($resultat) { - foreach($resultat as $row) { - echo "

"; - echo "
" . $row['ID'] . "
"; - echo "
" . $row['titre'] . "
"; - echo ""; - echo "
" . $row['auteur'] . "
"; - echo "
" . $row['classification'] . "
"; - } + $date = new Datetime($row[0]['date']) + echo "

"; + echo "
" . $row[0]['ID'] . "
"; + echo "
" . $row[0]['titre'] . "
"; + echo ""; + echo "
" . $row[0]['auteur'] . "
"; + echo "
" . $row[0]['classification'] . "
"; } echo "
"; echo $parsedown->text($markdownContent);