printLatestUpdatedAlbums() - error on showdate = true

Hello!
I hope maybe you can help me - whenever I call `printLatestUpdatedAlbums()` and set `$showdate = true` I get the following error:

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

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") { ...
`
Line 260: `'$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! :(

Comments

  • acrylian Administrator, Developer
    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?
  • melbe Member
    Hi acrylian, thank you!
    I just checked - `var_dump($latestimage)` is `NULL`.
  • acrylian Administrator, Developer
    I could reproduce it. The support build should have a fix.
  • melbe Member
    Thank you so much acrylian - finally had time to get the support build - perfect! :) Thank you for fixing it!
Sign In or Register to comment.