coppermine-gallery.com/forum

Support => cpg1.5.x Support => cpg1.5 miscellaneous => Topic started by: carolusabe on March 13, 2014, 08:05:50 PM

Title: Re: Critical error
Post by: carolusabe on March 13, 2014, 08:05:50 PM
Hi, i have an error like that, is not exactly the same but i read the rules and i think i don't need to create another topic. I read all your posts but the error continues when i want to go to an specific category:

QuoteCritical error: There was an error while processing a database query.

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 cpg15x3_albums AS a  LEFT JOIN cpg15x3_pictures AS p ON a.thumb=p.pid  WHERE a.category = 7   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

Gallery: http://merlinspain.com/galeria

I've looking solutions here but nothing works. Maybe you can help me if you please.
Thank you so much,
Carola

Title: Re: Re: Critical error
Post by: gmc on March 13, 2014, 08:40:21 PM
First you are running 1.5.10 which is over 3 years old:
2010-11-30 [M] Release of cpg1.5.10
There are many fixes and security issues between 1.5.10 and 1.5.26.

Looking at index.php for 1.5.10 - I see a similar query on line 771 (your message indicated 778)...
(SQL starts at line 766, issued at 771 - the last line I quoted)

    $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 a.pos, a.aid ' . $limit;
        $alb_thumbs_q = cpg_db_query($sql);

The ORDER BY criteria is hardcoded (not a variable) so don't know why that would be missing?

Have you made any modifications in this area?  or recently that could have changed things?
Can you post the code you have just above line 778?

Thanks!
Title: Re: Re: Critical error
Post by: carolusabe on March 13, 2014, 11:51:10 PM
QuoteFirst you are running 1.5.10 which is over 3 years old
How is that possible? I downloaded the latest version here:http://coppermine-gallery.net (http://coppermine-gallery.net)

QuoteHave you made any modifications in this area?  or recently that could have changed things?
No i haven't made any modifications.

QuoteCan you post the code you have just above line 778?

        $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);
        $alb_thumbs = cpg_db_fetch_rowset($alb_thumbs_q);
        mysql_free_result($alb_thumbs_q);


Thank you so much for your reply!
Title: Re: Re: Critical error
Post by: gmc on March 14, 2014, 01:04:21 AM
Strange that your page source says 1.5.10 (view page source and scroll to bottom... gives a commented eyecatcher of code level) but the failing code is in 1.5.26...

It does appear you are missing some config values in your database...
Appears the cpg_config table is at least missing a value for ''album_sort_order".
$sort_order is blank causing the error (no field listed in ORDER BY) which is set just above the failing code to:
$sort_order = $sort_array[$CONFIG['album_sort_order']];

You can run the same queries from André's post from January 28, 2014, 05:57:40 AM above...
You will need to change "cpg15x_" to your cpg table prefix.
Any INSERTS already there will tell you its a duplicate key... Any missing values will be added.

Post your results and we'll go from there...

Title: Re: Re: Critical error
Post by: phill104 on March 14, 2014, 08:34:03 AM
I am guessing some of the files were not uploaded correctly. If you go to http://merlinspain.com/galeria/sql/update.sql you can clearly see that file is from 1.5.10

Please download a fresh copy and follow the upgrade procedure as outlined in the docs making sure you run update.php at the end.
Title: Re: Critical error
Post by: ΑndrĂ© on March 14, 2014, 09:22:39 AM
Splitted from http://forum.coppermine-gallery.net/index.php/topic,77133.0.html
Title: Re: Critical error
Post by: carolusabe on March 15, 2014, 01:30:42 AM
I upgraded the gallery with a fresh copy and now it works. Thank you so much for your replies :)
Title: Re: Critical error
Post by: gmc on March 15, 2014, 02:13:39 AM
You're welcome.
Please mark the topic 'solved' using the button at bottom left of page.