Critical Error Critical Error
 

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

Main Menu

Critical Error

Started by strokesfan, May 11, 2014, 06:30:46 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

strokesfan

For some reason when I go to the 2nd level categories I get a critical error -
There was an error while processing a database query. When I put it on debug mode it says this:

-----
While executing query 'SELECT a.aid, a.title, a.description, a.thumb, a.keyword, category, visibility, filepath, filename, url_prefix, pwidth, pheight, a.owner  FROM cpg_albums AS a  LEFT JOIN cpg_pictures AS p ON a.thumb=p.pid  WHERE a.category = 37   ORDER BY  LIMIT 0,1' in index.php on line 778

mySQL error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'LIMIT 0,1' at line 1

File: /home/public_html/pictures/include/functions.inc.php - Line: 272
------

Thanks for any help you can give me!

gmc

The error is because their is no specification for the 'ORDER BY'... should be between the 'ORDER BY' and the 'LIMIT 0,1' - so a variable isn't properly populated...

You didn't proved a link to your gallery - nor the version/release you are running - so it is difficult to diagnose.
V1.5.28 does not contain the failing SQL statement on line 778.

Similar SQL is constructed beginning on line 714 and executed on line 731:

        $sort_array = array(
            'ta' => "a.title ASC, a.aid ASC",
            'td' => "a.title DESC, a.aid DESC",
            'da' => "a.aid ASC",
            'dd' => "a.aid DESC",
            'pa' => "a.pos ASC, a.aid ASC",
            'pd' => "a.pos DESC, a.aid DESC",
        );
        //$sort_code  = isset($USER['sort'])? $USER['sort'] : $CONFIG['album_sort_order'];
        //$sort_order = isset($sort_array[$sort_code]) ? $sort_array[$sort_code] : $sort_array[$CONFIG['album_sort_order']];
        $sort_order = $sort_array[$CONFIG['album_sort_order']];

        $sql = "SELECT a.aid, a.title, a.description, a.thumb, a.keyword, category, visibility, filepath, filename, url_prefix, pwidth, pheight, a.owner "
            . " FROM {$CONFIG['TABLE_ALBUMS']} AS a "
            . " LEFT JOIN {$CONFIG['TABLE_PICTURES']} AS p ON a.thumb=p.pid "
            . " WHERE a.category = $cat $album_filter "
            . " ORDER BY $sort_order $limit";
        $alb_thumbs_q = cpg_db_query($sql);


Please provide a link and/or the version release so I can confirm the statement...
Also what value is saved in you cpg_config table with name field of 'album_sort_order'?

From a tool like phpMyAdmin, you can issue SQL:
SELECT * from `cpg_config` WHERE `name` = 'album_sort_order'

Please post results...
Thanks!
Greg
My Coppermine Gallery
Need a web hosting account? See my gallery for an offer for CPG Forum users.
Send me money

strokesfan

Thanks! Here is my gallery - http://jessicaalbafan.com/pictures/index.php?cat=31

I put it in debug so you can see the error. Thanks again!

Αndré

Please upgrade to cpg 1.5.28 and don't forget to run update.php.

jipjip


Αndré

Quote from: jipjip on August 25, 2014, 12:39:40 AM
installed by 1nd1 autoinstaller
http://documentation.coppermine-gallery.net/en/auto-installers.htm


Quote<!--Coppermine Photo Gallery 1.5.24 (stable)-->
Please upgrade to the latest stable release (currently cpg 1.5.30) and don't forget to run update.php.

jipjip

Should I down latest version, remove auto installed version and, install it myself?

Αndré

Just follow our upgrade docs.