From 2c0e49507e23e8050cdc5c833b1303d745190bdb Mon Sep 17 00:00:00 2001 From: Shish Date: Sun, 17 Sep 2017 19:06:10 +0100 Subject: [PATCH] limit / offset --- ext/user/main.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/ext/user/main.php b/ext/user/main.php index 263af280..c3c8f776 100644 --- a/ext/user/main.php +++ b/ext/user/main.php @@ -118,8 +118,8 @@ class UserPage extends Extension { $offset = 0; $limit = 50; - $q = "SELECT * FROM users WHERE id >= :start AND id < :end"; - $a = array("start"=>$offset, "end"=>$offset+$limit); + $q = "SELECT * FROM users WHERE 1=1"; + $a = array("offset"=>$offset, "limit"=>$limit); if(@$_GET['username']) { $q .= " AND name LIKE :name"; @@ -136,6 +136,8 @@ class UserPage extends Extension { $a["class"] = $_GET['class']; } + $q .= " LIMIT :limit OFFSET :offset"; + $rows = $database->get_all($q, $a); $users = array_map("_new_user", $rows); $this->theme->display_user_list($page, $users, $user);