mysql error on comments

using printLatestComments() I get this error:

'
Zenphoto Error
MySQL Query ( SELECT c.id, c.name, c.website, c.date, c.comment, i.title, i.filename, a.folder, a.title AS albumtitle, FROM `zp_comments` AS c, `zp_images` AS i, `zp_albums` AS a WHERE `type`=images AND c.imageid = i.id AND i.albumid = a.id ORDER BY c.id DESC LIMIT 5 ) Failed. Error: You have an error in your SQL syntax near 'FROM `zp_comments` AS c, `zp_images` AS i, `zp_albums` AS a WHERE `type`=images' at line 1
,

however with using a query like:
' $comments = query_full_array("SELECT c.id, i.title, i.filename, a.folder, a.title AS albumtitle, c.name, c.website,"
. " (c.date + 0) AS date, c.comment, c.email, c.inmoderation FROM ".prefix('comments')." AS c, ".prefix('images')." AS i, ".prefix('albums')." AS a "
. " WHERE c.imageid = i.id AND i.albumid = a.id ORDER BY c.id DESC LIMIT 20" );'

I am able to retriev the commnets. I am using the nightlybuild 18 december..
any ideas?

Comments

  • Have you run setup.php with this version? The type field was added to the database when comments for albums was implemented.

    It is also possible that images needs to be enclosed in quotes.
  • yes I ran setup. checked the database table and in zp_comments there is a field named type.

    However phpmyadmin showed a warning on the table:

    "Warning More than one INDEX key was created for column `imageid`"

    indexes showed up til 19 keys: `imageid` `imageid_1`....`imageid_19`

    I just deleted all extra keys but no change on the error..

    and if I use the function: '<?php printLatestComments(1,'albums'); ?>'

    the error now is:

    MySQL Query ( SELECT c.id, c.name, c.website, c.date, c.comment, a.folder, a.title AS albumtitle, FROM `zp_comments` AS c, `zp_albums` AS a WHERE `type`=albums AND c.imageid = a.id ORDER BY c.id DESC LIMIT 1 ) Failed. Error: You have an error in your SQL syntax near 'FROM `zp_comments` AS c, `zp_albums` AS a WHERE `type`=albums AND c.imageid = a' at line 1
  • acrylian Administrator, Developer
    There is indeed a error in printlatestcomment(). We are working on it.
  • acrylian Administrator, Developer
    FYI: The printLatestComments function is fixed in the svn.
  • thanks!!
  • acrylian Administrator, Developer
    I forgot to mention that there is no longer an option to choose between images and albums comments, it prints just all latest comments from both. But now you can set the text length to shorten the comment...
    If you really need an image/album option let us know.
Sign In or Register to comment.