From f1c5edbea66098708612855b5fc1fd424cb008e2 Mon Sep 17 00:00:00 2001 From: Sebastian Korotkiewicz Date: Fri, 25 Mar 2022 03:21:25 +0100 Subject: fix previous button --- public_html/browser/get.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/public_html/browser/get.php b/public_html/browser/get.php index fa346c3..9282263 100644 --- a/public_html/browser/get.php +++ b/public_html/browser/get.php @@ -15,13 +15,13 @@ if (isset($_GET["random"]) || !isset($member)) { $stmt->execute(array(':login_name' => $member)); $row = $stmt->fetch(); // works - $stmt = $db->prepare("SELECT login_name FROM `websites` WHERE id > :id;"); + $stmt = $db->prepare("SELECT login_name FROM `websites` WHERE id > :id ORDER BY id DESC LIMIT 1;"); $stmt->execute(array(':id' => $row['id'])); $next = $stmt->fetch(); // works - $stmt = $db->prepare("SELECT login_name FROM `websites` WHERE id < :id;"); + $stmt = $db->prepare("SELECT login_name FROM `websites` WHERE id < :id ORDER BY id DESC LIMIT 1;"); $stmt->execute(array(':id' => $row['id'])); - $prev = $stmt->fetch(); // always return first record from database, why? + $prev = $stmt->fetch(); // works } $current = $row["login_name"]; -- cgit 1.4.1-2-gfad0