Update file news.php

This commit is contained in:
Jan BELLON 2024-03-08 18:53:00 +00:00
parent 97c6ea0614
commit 85c744f12d

View File

@ -69,16 +69,11 @@ if (filter_var($_GET['article'], FILTER_VALIDATE_INT)) {
echo "</div></div>";
} else {
$bdd = connect($dbhost, $dbname, $dbuser, $dbpass);
if (isset($_GET['search'])) {
$req = $bdd->prepare("SELECT ID, titre, date FROM articles WHERE classification <= :accreditation AND titre LIKE '%:search%'ORDER BY date DESC");
$req->bindParam(":search", $_GET['search']);
$req->bindParam(":accreditation", $_SESSION['accreditation']);
$req->execute();
} else {
$req = $bdd->prepare("SELECT ID, titre, date FROM articles WHERE classification <= :accreditation ORDER BY date DESC");
$req->bindParam(":accreditation", $_SESSION['accreditation']);
$req->execute();
}
$search = isset($_GET['search']) ? htmlspecialchars($_GET['search']) : ""
$req = $bdd->prepare("SELECT ID, titre, date FROM articles WHERE classification <= :accreditation AND titre LIKE '%:search%'ORDER BY date DESC");
$req->bindParam(":search", htmlspecialchars($_GET['search']));
$req->bindParam(":accreditation", $_SESSION['accreditation']);
$req->execute();
$resultat = $req->fetchAll(PDO::FETCH_ASSOC);
echo "<h1>Dernières news du Club</h1>";