aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorplegall <plg@piwigo.org>2010-05-24 11:12:23 +0000
committerplegall <plg@piwigo.org>2010-05-24 11:12:23 +0000
commit128e22b61249c2f462f7d4948223ef9995c60fe8 (patch)
tree047c307b0257d840870805c75fa64cbd09283cbe
parent0a2e040ae71fffe31d91943fd18feb6fccd97224 (diff)
bug 1682: r6312 was producing a MySQL error (depending on the MySQL server
version) because a count() implies a group by. This code change was checked against MySQL 5.0.75, MySQL 5.0.51 (where the error occured) and SQLite 3.6.22. git-svn-id: http://piwigo.org/svn/branches/2.1@6321 68402e56-0260-453c-a942-63ccdbb3a9ee
-rw-r--r--include/functions_user.inc.php3
1 files changed, 2 insertions, 1 deletions
diff --git a/include/functions_user.inc.php b/include/functions_user.inc.php
index 0c9412e38..3ba596633 100644
--- a/include/functions_user.inc.php
+++ b/include/functions_user.inc.php
@@ -301,10 +301,11 @@ SELECT
LEFT JOIN '.USER_CACHE_TABLE.' AS uc ON ui.user_id = uc.user_id
LEFT JOIN '.THEMES_TABLE.' AS t ON t.id = ui.theme
WHERE ui.user_id = \''.$user_id.'\'
+ GROUP BY ui.user_id
;';
$result = pwg_query($query);
$user_infos_row = pwg_db_fetch_assoc($result);
- if (0 == $user_infos_row['counter']) {
+ if (!isset($user_infos_row['counter']) or 0 == $user_infos_row['counter']) {
create_user_infos($user_id);
$result = pwg_query($query);