Author Topic: "DB Error: Bad SQL Query:" (don't see this in the list of errors)  (Read 4099 times)

0 Members and 1 Guest are viewing this topic.

Offline undrline

  • Newbie
  • *
  • Posts: 10
    • View Profile
"DB Error: Bad SQL Query:" (don't see this in the list of errors)
« on: September 01, 2006, 12:48:51 AM »
When using auto-thumbnailer for ftp'd files, I get this error:

Create thumbnail for: Isaac's Upsherin 010 (Isaac's Upsherin 010.jpg) ....   
DB Error: Bad SQL Query: UPDATE 4images_images SET image_thumb_file = 'Isaac's Upsherin 010.jpg' WHERE image_id = 591
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 's Upsherin 010.jpg' WHERE image_id = 591' at line 2

   Thumbnail created!


Using 1.7.2 (haven't found the time to manually go through and update the code).

Thumbnails aren't actually created, it uses the default thumb for the file type.

Here is my phpinfo().


It's huge to be able to ftp a bunch of digipix all at once.  The grandparents get upset if there aren't new enough pictures of their grandson  :roll:  Please help.  Thank you.


Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: "DB Error: Bad SQL Query:" (don't see this in the list of errors)
« Reply #1 on: September 01, 2006, 01:01:29 AM »
Its a bug...
in admin/thumbnailer.php find:
Code: [Select]
                  SET image_thumb_file = '".$image_cache[$key]['image_media_file']."'
Replace with:
Code: [Select]
                  SET image_thumb_file = '".addslashes($image_cache[$key]['image_media_file'])."'

Strange that nobody reported it before...even v1.7 affected :?

P.S. added bug fix:
http://www.4homepages.de/forum/index.php?topic=14417.0
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline undrline

  • Newbie
  • *
  • Posts: 10
    • View Profile
Re: "DB Error: Bad SQL Query:" (don't see this in the list of errors)
« Reply #2 on: September 01, 2006, 01:18:47 AM »
Yippee!  Worked.  Thanks.  Fast response!

Wasn't doing anything different than I had before, and never had the problem until recently (probably no apostrophes).  At least there was a fix.  I find it hard to believe that no one else had the problem though . . . soandso's birthday,  our family's vacation, and so forth . . . seems like it'd be used a lot for pictures' names.

The grandparents will be happy about the fix too.  :lol: