';
+ }
+ }
\ No newline at end of file
diff --git a/php/reports.php b/php/reports.php
index 3689747..ac2727d 100644
--- a/php/reports.php
+++ b/php/reports.php
@@ -2,6 +2,39 @@
@@ -111,12 +144,20 @@
query('SELECT tr.*, tq.question as original FROM triviareport tr INNER JOIN triviaquestion tq on tq.id=question_num ORDER BY id DESC LIMIT 10');
+ $q = $db->prepare('SELECT tr.*, tq.question as original
+ FROM triviareport tr
+ INNER JOIN triviaquestion tq
+ on tq.id=question_num
+ ORDER BY id DESC LIMIT :offset, :maxResults');
+ $qCount = $db->query('SELECT count(id) FROM triviareport');
+ $q->execute(array(':offset'=>($reportPage-1) * $maxResults, ':maxResults'=>$maxResults));
if ($q === false) {
die("Error: database error: table does not exist\n");
} else {
$result = $q->fetchAll();
+ $resultCount = $qCount->fetchColumn();
foreach($result as $res) {
echo '
';
echo '
' . $res['id'] . '
';
@@ -133,6 +174,10 @@
?>
+ paginate();
+ ?>
@@ -161,12 +206,20 @@
query('SELECT te.*, tq.question as original FROM triviaedit te INNER JOIN triviaquestion tq on tq.id=question_id ORDER BY id DESC LIMIT 10');
+ $q = $db->prepare('SELECT te.*, tq.question as original
+ FROM triviaedit te
+ INNER JOIN triviaquestion tq
+ on tq.id=question_id
+ ORDER BY id DESC LIMIT :offset, :maxResults');
+ $q->execute(array(':offset'=>($editPage-1) * $maxResults, ':maxResults'=>$maxResults));
+ $qCount = $db->query('SELECT count(id) FROM triviaedit');
if ($q === false) {
die("Error: database error: table does not exist\n");
} else {
$result = $q->fetchAll();
+ $resultCount = $qCount->fetchColumn();
foreach($result as $res) {
$isItalic = false;
$splitNew = explode('*', $res['question']);
@@ -224,6 +277,10 @@
?>
+ paginate();
+ ?>
@@ -251,12 +308,16 @@
query('SELECT tq.* FROM triviatemporaryquestion tq ORDER BY tq.id DESC LIMIT 10');
+ $q = $db->prepare('SELECT tq.* FROM triviatemporaryquestion tq ORDER BY tq.id DESC LIMIT :offset, :maxResults');
+ $q->execute(array(':offset'=>($newPage-1) * $maxResults, ':maxResults'=>$maxResults));
+ $qCount = $db->query('SELECT count(id) FROM triviatemporaryquestion');
if ($q === false) {
die("Error: database error: table does not exist\n");
} else {
$result = $q->fetchAll();
+ $resultCount = $qCount->fetchColumn();
foreach($result as $res) {
echo '
';
echo '
' . $res['id'] . '
';
@@ -271,6 +332,10 @@
?>
+ paginate();
+ ?>
diff --git a/php/user.php b/php/user.php
index 32993ac..25fda6b 100644
--- a/php/user.php
+++ b/php/user.php
@@ -2,6 +2,7 @@
@@ -105,6 +118,7 @@
prepare('select
tl.username,
@@ -113,13 +127,20 @@
from triviauserlog tl
where tl.username_canonical like :username
group by tl.username_canonical
- limit 20
+ limit :offset, :maxResults
');
- $q->execute(array(':username'=>'%'.$usernameCanonical.'%'));
+ $qCount = $db->prepare('select
+ count(distinct(tl.username_canonical))
+ from triviauserlog tl
+ where tl.username_canonical like :username
+ ');
+ $q->execute(array(':offset'=>($page-1) * $maxResults, ':maxResults'=>$maxResults, ':username'=>'%'.$usernameCanonical.'%'));
+ $qCount->execute(array(':username'=>'%'.$usernameCanonical.'%'));
if ($q === false) {
die("Error: database error: table does not exist\n");
} else {
$result = $q->fetchAll();
+ $resultCount = $qCount->fetchColumn();
foreach($result as $res) {
if(is_null($res['username'])) {
echo "