Member
Member
melbe   2015-06-21, 11:13
#1
Hello!
I hope maybe you can help me - whenever I call `printLatestUpdatedAlbums()` and set `$showdate = true` I get the following error:

[i] Fatal error: MySQLi Error: ( SELECT COUNT(*) FROM `[prefix]images` WHERE albumid = 39 AND mtime = ) failed. MySQLi returned the 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 '' at line 1 in /....../zp-core/functions-db-MySQLi.php on line 78 [/i]

For example :
`printLatestUpdatedAlbums(5,true, true, false, 40, '', NULL, NULL, NULL, '', false, false);`

Everything works fine as long as `$showdate` is `false`.
The error seems to happen in `image_album_statistics.php` :
`function printAlbumStatisticItem(...)`
within
`
if ($showdate) {
if ($option === "latestupdated") { ...
`
[b] Line 260: [/b]`'$count = db_count('images', "WHERE albumid = " . $tempalbum->getID() . " AND mtime = " . $latestimage['mtime']);'`

I'm not sure - but it appears that something is wrong in line 259 here:
`$latestimage = query_single_row("SELECT mtime FROM " . prefix('images') . " WHERE albumid = " . $tempalbum->getID() . " AND show = 1 ORDER BY id DESC");`
Because it seems in the line 260 `$latestimage['mtime']);'` is empty?And that messes up the SQL Syntax?

Appreciate any help, thank you! Sad
Administrator
Administrator
acrylian   2015-06-21, 17:05
#2
We will have to take a look. It seems that "mtime" is empty which would mean the first query does not return any latest image. Did you check what `$latestimage` contains?
Member
Member
melbe   2015-06-21, 18:17
#3
Hi acrylian, thank you!
I just checked - `var_dump($latestimage)` is `NULL`.
Administrator
Administrator
acrylian   2015-06-22, 16:42
#4
I could reproduce it. The support build should have a fix.
Member
Member
melbe   2015-06-26, 23:46
#5
Thank you so much acrylian - finally had time to get the support build - perfect! Smile Thank you for fixing it!
  
Powered By MyBB, © 2002-2026 MyBB Group.
Made with by Curves UI.