forum.coppermine-gallery.net

Support => cpg1.5.x Support => cpg1.5 miscellaneous => Topic started by: strokesfan on May 11, 2014, 06:30:46 am

Title: Critical Error
Post by: strokesfan on May 11, 2014, 06:30:46 am
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!
Title: Re: Critical Error
Post by: gmc on May 12, 2014, 08:06:40 pm
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:
Code: [Select]
        $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:
Code: [Select]
SELECT * from `cpg_config` WHERE `name` = 'album_sort_order'
Please post results...
Title: Re: Critical Error
Post by: strokesfan on May 15, 2014, 06:54:37 am
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!
Title: Re: Critical Error
Post by: Αndré on May 16, 2014, 11:20:40 am
Please upgrade to cpg 1.5.28 and don't forget to run update.php (http://jessicaalbafan.com/pictures/update.php).
Title: Re: Critical Error
Post by: jipjip on August 25, 2014, 12:39:40 am
I have same error was installed by 1nd1 autoinstaller

http://hotcelebs.co.uk/index.php?cat=2&page=2
Title: Re: Critical Error
Post by: Αndré on August 25, 2014, 10:26:35 am
installed by 1nd1 autoinstaller
http://documentation.coppermine-gallery.net/en/auto-installers.htm


Quote
<!--Coppermine Photo Gallery 1.5.24 (stable)-->
Please upgrade (http://documentation.coppermine-gallery.net/en/upgrading.htm) to the latest stable release (currently cpg 1.5.30) and don't forget to run update.php (http://hotcelebs.co.uk/update.php).
Title: Re: Critical Error
Post by: jipjip on August 25, 2014, 11:26:52 am
Should I down latest version, remove auto installed version and, install it myself?
Title: Re: Critical Error
Post by: Αndré on August 25, 2014, 11:33:48 am
Just follow our upgrade docs.