diff options
author | Sebastian Korotkiewicz <skorotkiewicz@gmail.com> | 2022-03-25 03:21:25 +0100 |
---|---|---|
committer | Sebastian Korotkiewicz <skorotkiewicz@gmail.com> | 2022-03-25 03:21:25 +0100 |
commit | f1c5edbea66098708612855b5fc1fd424cb008e2 (patch) | |
tree | 80cc5e8b98dbf903d77d2ef749ff47c4330e9809 /public_html/browser/get.php | |
parent | bf12d0faa1fb9468f48ebe1dd56223b24869f38f (diff) | |
download | site_roulette-main.tar.gz |
fix previous button main
Diffstat (limited to 'public_html/browser/get.php')
-rw-r--r-- | public_html/browser/get.php | 6 |
1 files 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"]; |