Advanced search  


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

Pages: [1]   Go Down

Author Topic: [Fixed]: Bug in functions.ini.php in combination with lightbox??  (Read 40468 times)

0 Members and 1 Guest are viewing this topic.


  • Coppermine newbie
  • Offline Offline
  • Posts: 15

Hi all

I have implemented lightbox in my coppermine 1.4.14 gallery. It worked all fine except by clicking on the random thumbnails I would get the error "There was an error while processing a database query".
The debug mode said:
While executing query "SELECT * FROM cpg14x_pictures WHERE approved = 'YES'  ORDER BY RAND() LIMIT -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 '-1' at line 1

File: /home/www/web170/html/domainxyz/gallery/include/ - Line: 249

That happens only when I click on the random images. The rest worked fine. I had to correct 2 lines in functions.ini.php (see below). After that i had no problems any more, all fine.

here the lines:
line 1229:
original: $query = "SELECT $select_columns FROM {$CONFIG['TABLE_PICTURES']} WHERE approved = 'YES' $META_ALBUM_SET ORDER BY RAND() LIMIT $limit2";

corrected:  $query = "SELECT $select_columns FROM {$CONFIG['TABLE_PICTURES']} WHERE approved = 'YES' $META_ALBUM_SET ORDER BY RAND() $limit";

line 1505:
original:  search_phrase = '$query_terms',
corrected: search_phrase = '$query_term',

I upgraded my gallery from 1.4.14 to 1.4.18. It went all smooth. Although, I had to do the same corrections in functions.ini.php for the same lines. Don't know if thats a bug from an older version of coppermine,  but might be double checked.
If you want to do more investigations let me know, I will set an testgallery so you can test the scenario.

« Last Edit: March 03, 2009, 01:58:47 am by Paver »


  • Dev Team member
  • Coppermine addict
  • ****
  • Country: us
  • Offline Offline
  • Gender: Male
  • Posts: 1609
  • Paul V.
Re: [Fixed]: Bug in functions.ini.php in combination with lightbox??
« Reply #1 on: March 03, 2009, 01:59:39 am »

Both bugs have been fixed and committed to the Subversion repositories (stable and devel).

Will be in 1.4.21 and higher.
Pages: [1]   Go Up

Page created in 0.016 seconds with 18 queries.