Bug in getItemByID

If a item does not exist it gives a :

"Fatal error: MySQL Error: ( SELECT * FROM `[prefix]albums` WHERE id = ) failed. MySQL returned the error MySQL not connected in /home1/glamwor2/public_html/clients.zen.com/zp-core/functions-db-MySQL.php on line 69"

$imageobject = getItemByID("images", '4000'); (wrong or removed ID)

any way to check the if exists to avoid this error so I can do a proper exit out the code?

Comments

  • The function can be improved to test the result of the first query and abort if it fails. But the error you report is strange. MySQL should simply have returned a syntax error, not aborted.
  • yea the abort kills my script ... :(
  • emdub Member
    I'm running into a similar error:

    Fatal error: MySQL Error: ( SELECT `id`, `date`, `data` FROM `[prefix]search_cache` WHERE `criteria`='a:5:{s:4:\"item\";s:6:\"albums\";s:6:\"fields\";s:4:\"tags\";s:6:\"search\";s:20:\"a:1:{i:0;s:3:\"Vue\";}\";s:4:\"sort\";s:1:\" \";s:4:\"user\";s:13:\"76.173.231.93\";}' ) failed. MySQL returned the error MySQL not connected in /var/www/vhosts/my-domain.com/httpdocs/gallery/zp-core/functions-db-MySQL.php on line 69

    I this first when clicking on an image's tag. If I hit the back button, any link will give the same error. If I start over (refresh gallery home), I can navigate normally, as long as I don't click a tag.

    I am not sure exactly when this started.
  • You should try clearing your search cache. But as to why MySQL is going away, your server or MySQL logs are the only possible clue.
  • emdub Member
    Setting Cache expiry to 0 in options -> search stops the error from occurring, but when I turn it back on, the errors start up again. I'm not sure where to clear it.

    I'll take a look at the MySQL logs to see if I can determine the underlying issue.
  • fretzl Administrator, Developer
    On the admin => overview tab are buttons to purge the cache.
Sign In or Register to comment.