Quote:
Originally Posted by ProtoPC
Where exactly in the two Select statements?...I added it at the end on both and got an error, ie:
$albumcount = $db->query_first("
SELECT COUNT(*) AS total
FROM " . TABLE_PREFIX . "album
WHERE state IN ('" . implode("', '", $state) . "')
AND album.visible > 0
");
|
I don't think you add that line to the end of the second SELECT statement (you do the first however, and it seems you have correctly done it based on your posted example) - here's how I did mine, on the first SELECT statement I did it just like yours, on the next one I added it right after the WHERE line and before the ORDER line as this made the most sense to me and lo and behold it worked on the first try. See if this helps:
SELECT album.*,
picture.pictureid, picture.extension, picture.idhash,
picture.thumbnail_dateline, picture.thumbnail_width, picture.thumbnail_height,
user.*
FROM " . TABLE_PREFIX . "album AS album
LEFT JOIN " . TABLE_PREFIX . "picture AS picture ON (album.coverpictureid = picture.pictureid AND picture.thumbnail_filesize > 0)
LEFT JOIN " . TABLE_PREFIX . "user AS user ON (album.userid = user.userid)
WHERE album.state IN ('" . implode("', '", $state) . "')
AND album.visible > 0
ORDER BY $sortname $sortorder
LIMIT $start, $perpage
");