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
This commit is contained in:
plegall 2010-05-24 11:12:23 +00:00
parent 0a2e040ae7
commit 128e22b612

View file

@ -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);