From a74b3ef90b74005691e5d03e381a79abef4a6016 Mon Sep 17 00:00:00 2001 From: biglyderv Date: Sat, 30 Nov 2024 17:32:26 -0500 Subject: [PATCH] pager --- docs/index.php | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/docs/index.php b/docs/index.php index 16b242b..6ed9c45 100644 --- a/docs/index.php +++ b/docs/index.php @@ -28,6 +28,8 @@ page_header(); $form_message = post_handler(); + + $page = array_key_exists('page',$_GET) ? ($_GET['page']) : 0; ?> - 'Your message', 'type' => 'textarea', 'name' => 'post', 'default' => '') )); } - - $stmt = $db->prepare("SELECT * FROM comment ORDER BY date DESC"); - $stmt->execute([]); +?> + +
+Previous +Next +
+ +prepare("SELECT * FROM comment ORDER BY date DESC LIMIT ? OFFSET ?"); + $stmt->execute([ + 10, + $page * 10 + ]); $posts = $stmt->fetchAll(PDO::FETCH_DEFAULT);