about summary refs log tree commit diff stats
path: root/public_html/browser
diff options
context:
space:
mode:
Diffstat (limited to 'public_html/browser')
-rw-r--r--public_html/browser/get.php6
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"];