From 2b58912b96e74e36d3bc2cd5d57d3e5c36c461f3 Mon Sep 17 00:00:00 2001 From: rvelices Date: Mon, 3 Nov 2014 21:07:33 +0000 Subject: bug 3163: pwg.tags.getImages mysql error if order parameter is provided git-svn-id: http://piwigo.org/svn/trunk@30359 68402e56-0260-453c-a942-63ccdbb3a9ee --- include/ws_functions/pwg.tags.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/include/ws_functions/pwg.tags.php b/include/ws_functions/pwg.tags.php index 09ce21bd0..c4ce2b7fc 100644 --- a/include/ws_functions/pwg.tags.php +++ b/include/ws_functions/pwg.tags.php @@ -110,11 +110,16 @@ function ws_tags_getImages($params, &$service) $where_clauses = implode(' AND ', $where_clauses); } + $order_by = ws_std_image_sql_order($params, 'i.'); + if (!empty($order_by)) + { + $order_by = 'ORDER BY '.$order_by; + } $image_ids = get_image_ids_for_tags( $tag_ids, $params['tag_mode_and'] ? 'AND' : 'OR', $where_clauses, - ws_std_image_sql_order($params) + $order_by ); $count_set = count($image_ids); @@ -136,7 +141,6 @@ SELECT image_id, GROUP_CONCAT(tag_id) AS tag_ids while ($row = pwg_db_fetch_assoc($result)) { $row['image_id'] = (int)$row['image_id']; - $image_ids[] = $row['image_id']; $image_tag_map[ $row['image_id'] ] = explode(',', $row['tag_ids']); } } -- cgit v1.2.3