limit / offset
This commit is contained in:
parent
47ff7f185e
commit
2c0e49507e
@ -118,8 +118,8 @@ class UserPage extends Extension {
|
|||||||
$offset = 0;
|
$offset = 0;
|
||||||
$limit = 50;
|
$limit = 50;
|
||||||
|
|
||||||
$q = "SELECT * FROM users WHERE id >= :start AND id < :end";
|
$q = "SELECT * FROM users WHERE 1=1";
|
||||||
$a = array("start"=>$offset, "end"=>$offset+$limit);
|
$a = array("offset"=>$offset, "limit"=>$limit);
|
||||||
|
|
||||||
if(@$_GET['username']) {
|
if(@$_GET['username']) {
|
||||||
$q .= " AND name LIKE :name";
|
$q .= " AND name LIKE :name";
|
||||||
@ -136,6 +136,8 @@ class UserPage extends Extension {
|
|||||||
$a["class"] = $_GET['class'];
|
$a["class"] = $_GET['class'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$q .= " LIMIT :limit OFFSET :offset";
|
||||||
|
|
||||||
$rows = $database->get_all($q, $a);
|
$rows = $database->get_all($q, $a);
|
||||||
$users = array_map("_new_user", $rows);
|
$users = array_map("_new_user", $rows);
|
||||||
$this->theme->display_user_list($page, $users, $user);
|
$this->theme->display_user_list($page, $users, $user);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user