aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorplegall <plg@piwigo.org>2015-12-01 13:53:57 +0100
committerplegall <plg@piwigo.org>2015-12-01 13:53:57 +0100
commit2080897f3b87ac1c1653232491c8bba56ede60f7 (patch)
tree33decf311572211a7d535eb751692f3d21d77c26 /include
parent64d6beb13e27db6cbd4baf795fe71e3a98bb73ba (diff)
faster SQL, by @mistic100
Diffstat (limited to 'include')
-rw-r--r--include/ws_functions/pwg.categories.php12
1 files changed, 6 insertions, 6 deletions
diff --git a/include/ws_functions/pwg.categories.php b/include/ws_functions/pwg.categories.php
index 4fece14ec..07e64c803 100644
--- a/include/ws_functions/pwg.categories.php
+++ b/include/ws_functions/pwg.categories.php
@@ -676,12 +676,12 @@ function ws_categories_deleteRepresentative($params, &$service)
// does the category really exist?
$query = '
-SELECT COUNT(*)
+SELECT id
FROM '. CATEGORIES_TABLE .'
WHERE id = '. $params['category_id'] .'
;';
- list($count) = pwg_db_fetch_row(pwg_query($query));
- if ($count == 0)
+ $result = pwg_query($query);
+ if (pwg_db_num_rows($result) == 0)
{
return new PwgError(404, 'category_id not found');
}
@@ -713,12 +713,12 @@ function ws_categories_refreshRepresentative($params, &$service)
// does the category really exist?
$query = '
-SELECT COUNT(*)
+SELECT id
FROM '. CATEGORIES_TABLE .'
WHERE id = '. $params['category_id'] .'
;';
- list($count) = pwg_db_fetch_row(pwg_query($query));
- if ($count == 0)
+ $result = pwg_query($query);
+ if (pwg_db_num_rows($result) == 0)
{
return new PwgError(404, 'category_id not found');
}