coppermine-gallery.com/forum

Support => Older/other versions => cpg1.3.x Support => Topic started by: dj_jojo on November 16, 2005, 04:13:20 PM

Title: Critical error - Sql syntax
Post by: dj_jojo on November 16, 2005, 04:13:20 PM
when i try to select a category to show albums the gallery returns critical error :S

QuoteWhile executing query "SELECT a.aid, a.title, a.description, visibility, filepath, filename, url_prefix, pwidth, pheight FROM cpg134_albums as a LEFT JOIN cpg134_pictures as p ON a.thumb=p.pid WHERE category=8 ORDER BY a.posLIMIT 0,1" on 0

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 '0,1' at line 1

any suggestions and help.
Regards
D.
Title: Re: Critical error - Sql syntax
Post by: Abbas Ali on November 16, 2005, 04:43:52 PM
The problem is

Quotea.posLIMIT
in the query. There should be a space between a.pos and LIMIT i.e. it should be

Quote
a.pos LIMIT

Did you modified any files? If so then correct the query in that file.
Title: Re: Critical error - Sql syntax
Post by: dj_jojo on November 16, 2005, 05:03:53 PM
hmm.. no i have only changed some of the Language files..... i'll try to overwrite functions file.


do you have any clue about which file could be causing the error beside the functions file?


regards
Dragan
Title: Re: Critical error - Sql syntax
Post by: Nibbler on November 16, 2005, 05:06:02 PM
It's in index.php here:


    $sql = 'SELECT a.aid, a.title, a.description, visibility, filepath, '.
           'filename, url_prefix, pwidth, pheight '.
           'FROM '.$CONFIG['TABLE_ALBUMS'].' as a '.
           'LEFT JOIN '.$CONFIG['TABLE_PICTURES'].' as p '.
           'ON a.thumb=p.pid '.
           'WHERE category='.$cat.$album_filter.
           ' ORDER BY a.pos '.
           $limit;


Should be easy to fix, just add in a space.
Title: Re: Critical error - Sql syntax
Post by: dj_jojo on November 16, 2005, 05:09:14 PM
 ;D

well done boys  :o  ; you have both earned a bottle of beer  ;)

muchos gracias

Regards
D.