From b9ddcf17f11c90218b4f62ba550cbdd29257a625 Mon Sep 17 00:00:00 2001 From: plegall Date: Tue, 21 Feb 2023 15:17:24 +0100 Subject: [PATCH] fixes #1871 move the retrieve of the number of queried rows The FOUND_ROWS() must be performed right after the SQL_CALC_FOUND_ROWS but commit 4d81d28eca10a69695164093e97adb66c19056f9 had added some new SQL queries in between. --- include/ws_functions/pwg.categories.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/ws_functions/pwg.categories.php b/include/ws_functions/pwg.categories.php index 38357c6b3..897d4d416 100644 --- a/include/ws_functions/pwg.categories.php +++ b/include/ws_functions/pwg.categories.php @@ -116,6 +116,8 @@ SELECT SQL_CALC_FOUND_ROWS i.* $images[] = $image; } + list($total_images) = pwg_db_fetch_row(pwg_query('SELECT FOUND_ROWS()')); + // let's take care of adding the related albums to each photo if (count($image_ids) > 0) { @@ -189,8 +191,6 @@ SELECT } } - list($total_images) = pwg_db_fetch_row(pwg_query('SELECT FOUND_ROWS()')); - return array( 'paging' => new PwgNamedStruct( array(