limit / offset

This commit is contained in:
Shish 2017-09-17 19:06:10 +01:00
parent 47ff7f185e
commit 2c0e49507e

View File

@ -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);