Highest Rated Custom Function not working

Hi everyone,
On my website (www.dualmonitorbackgrounds.com) I want to have the albums ordered by rating instead of alphabetically, so I tried out the Highest Rated Custom Function from the zenphoto Trac site, but I get a MySQL error:

`MySQL Query ( SELECT images.albumid, images.filename AS filename, images.title AS title, images.total_value AS totalvalue, images.total_votes as votes, albums.folder AS folder FROM images AS images, albums AS albums WHERE images.albumid = albums.id AND images.show = 1 ORDER BY (images.total_value/images.total_votes) DESC LIMIT ) Failed. 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`

Can anyone see an error in the syntax? Is it working for anyone else? If so, did you have to modify something?
Thanks

Comments

  • So you're the designer of that fantastic bit of zenphoto code, eh? (didn't quite make the connection at first). I downloaded one of your wallpapers for my new work dual monitor setup just yesterday, after you posted your site in the "sites that use zenphoto" post. And I got the Ultramon program. What a fantastic little app.

    Anyway, I digress. The highest rated custom function requires the Zenphoto Rating Hack to be configured and working, as well as the DB modifications added before you can use the Highest Rated Custom Function. This requires DB mods, so make sure you're comfortable with that before proceeding.

    I didn't write either function or the hack, but I have implemented both on my zenphoto implementations (see http://www.thinkdreams.com/zenphoto or http://www.bushwoodworking.com/zenphoto - both using the same theme right now) and they seem to work just fine.

    I'll be happy to help you configure it and get it working if you want. It's not horribly difficult, just time consuming and a bit tricky.

    You can grab everything you need for the Image Rating Hack off the wiki at http://www.zenphoto.org/trac/wiki/ZenphotoHacks#ImageRatingHack, and let me know if you have trouble.
  • Wow, thanks for the kind words :) Yeah the site is coming along slowly. Ultramon is awesome, it's the first app I install after a reformat, right after gpu drivers. The smart taskbar is pretty much essential for using dual monitors effectively. The guy who makes UltraMon was kind enough to add dmb to his links page without me even asking, generates a fair bit of traffic.
    That's great your work has dual monitors, it's becoming a trend in businesses slowly (which is why I made dmb, anticipating a large future market). I've definitely noticed my productivity increase with two, especially when I make websites (I run www.redskiesdesign.com also) it's great to have DreamWeaver in one screen and the preview in Flock on the other screen.

    Anyway, I've had the image rating hack running for a while, you can see it below each image. Help with the Highest Rated Custom Function would be great! :)

    Eventually I would like there to be an option of sorting. I want to have a dropdown list of, say:
    Highest Rated
    Most Commented On
    Recently Added
    Etc.
    From the top of my head I think that's how Caedes does it. I actually originally offered to buy the Caedes code (before I found zenphoto) but the guy who makes it wouldn't sell. I'm glad though, their system uses a few other languages, so I'm much happier using just PHP, MySQL, JavaScript and things like that.

    I think when there are enough images that will become an essential feature; sorting alphabetically is already a problem and I would like users to be able to choose for themselves what is most important to them. For the moment I'm happy with just getting everything sorted by rating though.
    Anyway I blabbed on a bit there. Wow, make that a lot.
    Look forward to your reply :)
  • well, if you have the image rating hack working, then really the only other thing I could see it being is the prefix for the sql query. where did you put the database additions for the image rating hack? if they aren't in the images table, then the query above won't work properly. The original instructions from the funbox site suggested putting them in another table, but i chose the images table, which doesn't seem to hurt anything for now, but later on, as Tristan changes zenphoto, it might. So the better way to do it is to follow the original instructions.

    Anyway, try that. Change the prefix. If you aren't using the images table for your image rating DB fields, that is.
  • curiouz Member
    Hi Guys,
    I get exactly the same error as SubJunk. Did you already figure out a solution? Thanks!
  • curiouz Member
    Ok, I got the hack to work :D
    An other thing came up though. The thumbs of the highest rated images are too large. Can I somehow change that with css?
  • SubJunk Member
    Best to change the actual images yourself I think. If you'd like me to do that for you, just send me an email at subjunkNO@SPAMgmail.com
Sign In or Register to comment.