Add offset

This commit is contained in:
nonmakina 2021-01-18 04:35:34 -06:00
parent f9bf65ecb7
commit 771a1e1629
1 changed files with 1 additions and 1 deletions

View File

@ -101,7 +101,7 @@
* Retrieve count of images and posts in a thread * Retrieve count of images and posts in a thread
*/ */
private function fetchThreadCount($board, $thread_id, $preview_count) { private function fetchThreadCount($board, $thread_id, $preview_count) {
$query = prepare("SELECT COUNT(NULLIF(TRIM(files), '')) as file_count, COUNT(id) as post_count FROM ``posts_$board`` WHERE `thread` = :id ORDER BY `time` DESC OFFSET :offset"); $query = prepare("SELECT COUNT(NULLIF(TRIM(files), '')) as file_count, COUNT(id) as post_count FROM ``posts_$board`` WHERE `thread` = :id ORDER BY `time` DESC LIMIT :offset , 18446744073709551615;");
$query->bindValue(':id', $thread_id, PDO::PARAM_INT); $query->bindValue(':id', $thread_id, PDO::PARAM_INT);
$query->bindValue(':offset', $preview_count, PDO::PARAM_INT); $query->bindValue(':offset', $preview_count, PDO::PARAM_INT);
$query->execute() or error(db_error($query)); $query->execute() or error(db_error($query));