$req->closeCursor(); ?> </div> <div class="commentaires"> <h2>Commentaires :</h2> <?php //On appelle la class pagination.class include_once 'pagination.class.php'; //On crée un nouvelle objet $pagination $pagination = new Pagination(5, 'commentaires'); $return_nb_entry = $bdd->prepare('SELECT COUNT(*) AS total_entree FROM commentaires WHERE id_billet = :id'); $return_nb_entry->bindValue('id', $_GET['id'], PDO::PARAM_INT); $return_nb_entry->execute(); $nb_entry = $return_nb_entry->fetch(); $total_entry = $nb_entry['total_entree']; $pagination->setTotal_entry($total_entry, 5); //On demande les données calculé par la class $actual_page = $pagination->getActual_page(); $first_entry = $pagination->getFirst_entry(); $max_entry_page = $pagination->getMax_entry_page(); $nb_page = $pagination->getNb_page(); //On effectue une demande pour recupérer les 5 messages en rapport fiavec la page $req = $bdd->prepare('SELECT id, id_billet, pseudo, commentaire, DATE_FORMAT(date_creation, \'Le %d/%m/%Y à %Hh%imin%ss :\') as date_creation_fr FROM commentaires WHERE id_billet = :id ORDER BY id DESC LIMIT :rst_entry , :max_entry_page'); $req->bindValue('first_entry', $first_entry, PDO::PARAM_INT); $req->bindValue('max_entry_page', $max_entry_page, PDO::PARAM_INT); $req->bindValue('id', $_GET['id'], PDO::PARAM_INT); $req->execute(); //On affiche les messages grace a une boucle while et sécurise avec htmlspecialchars while ($data = $req->fetch()) { echo '<h4>' . htmlspecialchars($data['pseudo']) . '