Bizarre MySQL error with Chrome & Safari

I have a really bizarre error that only shows on Chrome and Safari, but not FF or IE. It appears when using my own function based on printRandomImages(), but it also appears when using actual printRandomImages(5,'','all','',200,200,false); The message is shown below. The rest of the site looks OK, but I'm completely stumped as to why it only appears in these two browsers. I've been extensively testing using FF and IE, but this was just some additional testing. Any help or thoughts would be appreciated

Zenphoto Error
MySQL Query ( SELECT COUNT(*) AS row_count FROM `SkiClub_images`, `SkiClub_albums` WHERE `SkiClub_albums`.folder!="" AND `SkiClub_images`.albumid = `SkiClub_albums`.id AND `SkiClub_albums`.show = 1 AND `SkiClub_images`.show=1 ) 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 'show = 1 AND `SkiClub_images`.show=1' at line 1

Comments

  • Using any browser on another computer gets the same error message, but it does not appear on the one I work with - the random images are selected and correctly displayed, and yes they are different random images each time. I just don't understand how this server code issue can be OK on the computer I work with and not elsewhere! I reinstalled the whole of the template-functions file and still the same situation. I've cleared the cache on the work computer and get the same situation.

    For information, the images are in the sidebar and I note there was an MySQL error report with this function in the sidebar about a year ago, but that appears to have corrected.
  • acrylian Administrator, Developer
    What sidebar? Except the Zenpage default theme no zenphoto theme uses a sidebar.

    Did setup complain about anything? Anyway, a mysql error could never be browser dependend. Assuming you use the latest version please check that you really have uploaded all files correctly. Please try a complete reinstall.

    Also a link to the site in question would be helpful.
  • What version of MySQL are you running?
  • Thanks for the replies. I know the error couldn't be browser dependent - hence it was bizarre! I've got to the bottom of what causes the problem - but not got a solution.

    Regardless of browser or machine, the function works when I'm logged in - either using my full admin rights or as a limited admin user. This explains why I could see everything OK on my work machine, because I use FF as my main browser (logged in with full admin rights) and IE to check compatibility etc (logged in as a limited user). Safari and Chrome are both used for testing, but I wasn't logged in, just viewing.

    The sidebar is an amended version of the ZenPage Default, but on further experimentation, the error occurs in normal pages as well.

    MySQL is 4.0. I don't recall any errors on setup, but I wouldn't swear to it, as it all seemed to work, although there may have been warnings.

    Another strange thing I've just noticed is that unpublished pages are shown when logged in as admin, but are not (correctly) when not logged in. Is this a connected issue?

    I've removed the section from the test site for the moment, but if you'd like to see it, I could put is back and give you the link.
  • The thing that is being complained about is the `show` field. That is also an MySQL reserved word, so when standing by itself it would need to be enclosed in peck marks (the things that make the green display on this forum.) But it is supposed to be ok to use it qualified as with the query above (`SkiClub_images.show`) So what you can try is to put the whole field reference within the peck marks, not just the database table name.

    The reason you do not get the errors when logged in is that this clause `show` is omitted in that case because admins are allowed to view unpublished images/albums.
  • Once again thanks for the reply, but where do I make the change(s)?
  • You have to find the statement above in your random image function. You will see `prefix('album').".show=1'` (and similar for image). Change to `prefix('album.show').'=1'`
  • I've made the changes and not get a similar but slightly different error message:

    MySQL Query ( SELECT COUNT(*) AS row_count FROM `SkiClub_images`, `SkiClub_albums` WHERE `SkiClub_albums`.folder!="" AND `SkiClub_images`.albumid = `SkiClub_albums`.id AND `SkiClub_albums.show`=1 AND `SkiClub_images.show`=1 ) failed. Error: Unknown column 'SkiClub_albums.show' in 'where clause'
  • Sorry, I am out of suggestions. Can you upgrade your MySql?
Sign In or Register to comment.