Advanced search  

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Pages: [1]   Go Down

Author Topic: Critical error - Sql syntax  (Read 3366 times)

0 Members and 1 Guest are viewing this topic.

dj_jojo

  • Coppermine newbie
  • Offline Offline
  • Posts: 3
Critical error - Sql syntax
« on: November 16, 2005, 04:13:20 pm »

when i try to select a category to show albums the gallery returns critical error :S

Quote
While 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.
« Last Edit: November 16, 2005, 05:12:26 pm by Nibbler »
Logged

Abbas Ali

  • Administrator
  • Coppermine addict
  • *****
  • Country: in
  • Offline Offline
  • Gender: Male
  • Posts: 2165
  • Spread the PHP Web
    • Ranium Systems
Re: Critical error - Sql syntax
« Reply #1 on: November 16, 2005, 04:43:52 pm »

The problem is

Quote
a.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.
Logged
Chief Geek at Ranium Systems

dj_jojo

  • Coppermine newbie
  • Offline Offline
  • Posts: 3
Re: Critical error - Sql syntax
« Reply #2 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
Logged

Nibbler

  • Guest
Re: Critical error - Sql syntax
« Reply #3 on: November 16, 2005, 05:06:02 pm »

It's in index.php here:

Code: [Select]
    $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.
Logged

dj_jojo

  • Coppermine newbie
  • Offline Offline
  • Posts: 3
Re: Critical error - Sql syntax
« Reply #4 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.
Logged
Pages: [1]   Go Up
 

Page created in 0.013 seconds with 16 queries.