forum.coppermine-gallery.net

Dev Board => cpg1.4 Testing/Bugs => cpg1.4 Testing/Bugs: FIXED/CLOSED => Topic started by: Ivo007 on April 23, 2008, 02:47:22 am

Title: [Fixed]: Bug in functions.ini.php in combination with lightbox??
Post by: Ivo007 on April 23, 2008, 02:47:22 am
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/functions.inc.php - 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.

Cheers
Ivo
Title: Re: [Fixed]: Bug in functions.ini.php in combination with lightbox??
Post by: Paver 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.