Problème pour lister les topics épinglés-créer un forum

Coco3444

Coco3444 Le 10 avril 2021 à 11:44 (Édité le 10 avril 2021 à 11:47)

J'ai rencontré un problème un peu énérvant qunad j'ai rajouté mon système qui liste les topics épinglés. Mon code PHP: <?php session_start(); require('php/config.php'); require('php/functions.php'); $categories = $bdd->query('SELECT * FROM f_categories ORDER BY nom'); $subcat = $bdd->prepare('SELECT * FROM f_souscategories WHERE id_categorie = ? ORDER BY nom'); $epingle = $bdd->query('SELECT * FROM f_topics WHERE epingle = 1 ORDER by date_time_publication'); ?> Mon code html: (je n'ai pas utilisé l'architecture de @PrimFX ) <!DOCTYPE html> <html lang="fr"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="description" content=""> <meta name="author" content="HyperC team and Galahad contributors"> <meta name="generator" content="Hugo 0.80.0"> <title>Forum · HyperC</title> <link rel="canonical" href="https://getbootstrap.com/docs/5.0/examples/offcanvas/"> <!-- Bootstrap core CSS --> <link href="https://hyperc.mtxserv.com/forum/assets/dist/css/bootstrap.min.css" rel="stylesheet"> <style> .bd-placeholder-img { font-size: 1.125rem; text-anchor: middle; -webkit-user-select: none; -moz-user-select: none; user-select: none; } @media (min-width: 768px) { .bd-placeholder-img-lg { font-size: 3.5rem; } } </style> <!-- Custom styles for this template --> <link href="offcanvas.css" rel="stylesheet"> </head> <body class="bg-light"> <header class="mb-auto"> <div> <h3 class="float-md-start mb-0">HyperC</h3> <nav class="nav nav-masthead justify-content-center float-md-end"> <a class="nav-link active" aria-current="page" href="https://hyperc.mtxserv.com/index.php">Accueil</a> <a class="nav-link" href="https://hyperc.mtxserv.com/menu/projects.php">Nos projets</a> <a class="nav-link" href="https://hyperc.mtxserv.com/menu/aboutwe.php">Qui sommes-nous?</a> <a class="nav-link" href="https://hyperc.mtxserv.com/forum/index.php">Forum</a> <a class="nav-link" href="https://hyperc.mtxserv.com/member-space/index.php">Espace Membre</a> </nav> </div> </header> <?php if(isset($_SESSION['id'])){ ?> <div class="nav-scroller bg--body shadow-sm"> <nav class="nav nav-underline" aria-label="Secondary navigation"> <a class="nav-link active" aria-current="page" href="#">Dashboard Forum</a> <a class="nav-link" href="https://hyperc.mtxserv.com/forum/index.php">Accueil</a> <a class="nav-link" href="https://hyperc.mtxserv.com/forum/followers.php"> Followers <span class="badge bg-light text-dark rounded-pill align-text-bottom">nb_followers</span> </a> <a class="nav-link" href="https://hyperc.mtxserv.com/profil.php?id=<?= $_SESSION['id'] ?>">Profil</a> </nav> </div> <?php }?> <main class="container"> <div class="d-flex align-items-center p-3 my-3 text-white bg-purple rounded shadow-sm"> <img class="me-3" src="../assets/brand/bootstrap-logo-white.svg" alt="" width="48" height="38"> <div class="lh-1"> <h1 class="h6 mb-0 text-white lh-1">Forum HyperC</h1> <small>Lisez les règles dans les topics épinglés!</small> </div> </div> <div class="my-3 p-3 bg-body rounded shadow-sm"> <h6 class="border-bottom pb-2 mb-0">Topics épinglés</h6> <?php while($e = $epingle->fetch()){ ?> <div class="d-flex text-muted pt-3"> <svg class="bd-placeholder-img flex-shrink-0 me-2 rounded" width="32" height="32" xmlns="http://www.w3.org/2000/svg" role="img" aria-label="Placeholder: 32x32" preserveAspectRatio="xMidYMid slice" focusable="false"><title>Placeholder</title><rect width="100%" height="100%" fill="#007bff"/><text x="50%" y="50%" fill="#007bff" dy=".3em">32x32</text></svg> <p class="pb-3 mb-0 small lh-sm border-bottom"> <a href="#" class="d-block text-gray-dark"><?= $e['titre'] ?></a> </p> </div> <?php } ?> </div> <div class="my-3 p-3 bg-body rounded shadow-sm"> <h6 class="border-bottom pb-2 mb-0">Catégories</h6> <?php while($c = $categories->fetch()){ $subcat->execute(array($c['id'])); $souscategories = ''; while($sc = $subcat->fetch()){ $souscategories .= '<a href="">'.$sc['nom'].' </a> | '; } $souscategories = substr($souscategories, 0, -3) ?> <div class="d-flex text-muted pt-3"> <svg class="bd-placeholder-img flex-shrink-0 me-2 rounded" width="32" height="32" xmlns="http://www.w3.org/2000/svg" role="img" aria-label="Placeholder: 32x32" preserveAspectRatio="xMidYMid slice" focusable="false"><title>Placeholder</title><rect width="100%" height="100%" fill="#007bff"/><text x="50%" y="50%" fill="#007bff" dy=".3em">32x32</text></svg> <div class="pb-3 mb-0 small lh-sm border-bottom w-100"> <div class="d-flex justify-content-between"> <a href="#" class="text-gray-dark"><?= $c['nom'] ?></a> </div> <span class="d-block"> <?= $souscategories ?> </span> <span class="d-block">messages: nbr_messages</span> </div> </div> <?php } ?> </div> </main> <script src="https://hyperc.mtxserv.com/forum/assets/dist/js/bootstrap.bundle.min.js"></script> <script src="offcanvas.js"></script> </body> </html>

J'ai une erreur comme quoi la fonction fetch() ne paeut pas etre utilisée à la ligne 90.

Vous devez être connecté pour poster une réponse. Se connecter ou Créer un compte