Advanced search  

News:

CPG Release 1.6.26
Correct PHP8.2 issues with user and language managers.
Additional fixes for PHP 8.2
Correct PHP8 error with SMF 2.0 bridge.
Correct IPTC supplimental category parsing.
Download and info HERE

Pages: [1]   Go Down

Author Topic: Critical error: There was an error while processing a database query  (Read 2050 times)

0 Members and 1 Guest are viewing this topic.

HVW

  • Coppermine newbie
  • Offline Offline
  • Posts: 2

I just finished a fresh new install of Coppermine 1.6.26. After a succesfully install I get an error on my Coppermine page.
All settings are still default, nothing changed yet.
I checked update.php, no errors.

These are my site settings:
http://beeldbank.hvwormerveer.nl/
CPG version: 1.6.26
PHP version: 8.2.15

Is there anyone who can help me with this problem?
Logged

HVW

  • Coppermine newbie
  • Offline Offline
  • Posts: 2
Re: Critical error: There was an error while processing a database query
« Reply #1 on: February 29, 2024, 09:39:45 pm »

Fixed it by myself!

My conclusion is that the cause of this problem is in the 'sql_mode'. That setting is managed by the hosting partner, so I had to make a workaround.
In the logging of Coppermine I found errors:

Quote
GROUP BY r.aid
ORDER BY NULL' in index.php on line 362 the following error was encountered:
1055 : 'databasename.c.cid' isn't in GROUP BY

I edited index.php from this:
Quote
    // album stats for regular albums
    $sql = "SELECT r.aid, c.cid, COUNT(pid) AS pic_count, MAX(pid) AS last_pid, MAX(ctime) AS last_upload, depth AS level, lft
        FROM {$CONFIG['TABLE_CATEGORIES']} AS c
        INNER JOIN {$CONFIG['TABLE_ALBUMS']} AS r ON r.category = c.cid
        INNER JOIN {$CONFIG['TABLE_PICTURES']} AS p ON p.aid = r.aid
        WHERE c.depth >= $CURRENT_CAT_DEPTH + 1
        AND approved = 'YES'
        $forbidden_set
        $lft_rgt
        GROUP BY r.aid
        ORDER BY NULL";
To this:
Quote
    // album stats for regular albums
    $sql = "SELECT r.aid, c.cid, COUNT(pid) AS pic_count, MAX(pid) AS last_pid, MAX(ctime) AS last_upload, depth AS level, lft
        FROM {$CONFIG['TABLE_CATEGORIES']} AS c
        INNER JOIN {$CONFIG['TABLE_ALBUMS']} AS r ON r.category = c.cid
        INNER JOIN {$CONFIG['TABLE_PICTURES']} AS p ON p.aid = r.aid
        WHERE c.depth >= $CURRENT_CAT_DEPTH + 1
        AND approved = 'YES'
        $forbidden_set
        $lft_rgt
        GROUP BY r.aid, c.cid, c.depth, c.lft
        ORDER BY NULL";

Then the error dissapeared and Coppermine worked like a charm!
Logged
Pages: [1]   Go Up
 

Page created in 0.024 seconds with 19 queries.