Posted on: 05/23/10 06:14pm
By: Anonymous (James)
We are getting a bunch of MySQL errors in our site. We just upgraded to 1.7.0 a couple of weeks ago. Here is one of them we get several times a day.
SELECT COUNT(*) FROM%'
AND (title LIKE '%youtube%' OR introtext LIKE '%youtube%' OR bodytext LIKE '%youtube%'
)
Any suggestions of where to find this error and how to fix?
Re: MySQL errors in 1.7.0
Posted on: 05/24/10 03:54am
By: Dirk
Can you reproduce the error when you enter that search term?
The SQL query is missing the table name. The introtext/bodytext looks like this would be related to stories, but I'd doubt that we have such a glaring bug there. Could this come from a plugin that's making use of stories?
bye, Dirk
Re: MySQL errors in 1.7.0
Posted on: 05/24/10 09:04am
By: Anonymous (James)
Hi Dirk,
I can't reproduce the issue my self, but I see it continuously in the logs. This is on the mac os x hints site, which we upgraded a few weeks ago. I did the upgrade for them, with Robs input.
Here are more lines from just an hour ago:
Text Formatted Code
Mon 24 May 2010 05:45:54 PDT - 1064: 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 '%') AND (title LIKE '%safari%' OR introtext LIKE '%safari%' OR bodytext LIKE '%s' at line 1. SQL in question: SELECT COUNT(*) FROM%') AND (title LIKE '%safari%' OR introtext LIKE '%safari%' OR bodytext LIKE '%safari%'))
Mon 24 May 2010 05:45:54 PDT - 256 - An SQL error has occurred. Please see error.log for details. @ /web/macosxhints.com/system/databases/mysql.class.php line 261
The plugins in the plugins folder:
calendar
captcha
commentsfeeds
links
polls
rating
spamx
staticpages
xmlsitemap
Re: MySQL errors in 1.7.0
Posted on: 05/26/10 08:31am
By: Anonymous (James)
No thoughts on this issue?
Re: MySQL errors in 1.7.0
Posted on: 05/26/10 05:16pm
By: Dirk
I had a look through the code and to me this doesn't look like it's an SQL request produced by Geeklog. But since it doesn't happen all the time, I may have missed something, so I've asked Sami for a second opinion. He's travelling this week though, so it may take a few days for him to get back to us.
It would help if you could find a way to reproduce the error.
bye, Dirk
Re: MySQL errors in 1.7.0
Posted on: 05/31/10 06:33pm
By: sbarakat
Quote by: James
Text Formatted Code
Mon 24 May 2010 05:45:54 PDT - 1064: 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 '%') AND (title LIKE '%safari%' OR introtext LIKE '%safari%' OR bodytext LIKE '%s' at line 1. SQL in question: SELECT COUNT(*) FROM%') AND (title LIKE '%safari%' OR introtext LIKE '%safari%' OR bodytext LIKE '%safari%'))
Mon 24 May 2010 05:45:54 PDT - 256 - An SQL error has occurred. Please see error.log for details. @ /web/macosxhints.com/system/databases/mysql.class.php line 261
As Dirk mentioned it does look like it fails searching the stories of the site. But I think there are two terms being used here. If I match it up against a SELECT statment that works (alignment may be a bit out)
Text Formatted Code
SELECT COUNT(*) FROM%') AND (title LIKE '%safari%' OR introtext LIKE '%safari%' OR bodytext LIKE '%safari%'))
SELECT ... FROM ... WHERE ... AND ((title LIKE '%safari%' OR introtext LIKE '%safari%' OR bodytext LIKE '%safari%'))
You can see that if it were one search term there would be a double bracket after the AND, eg.
AND (( instead of
%' ) AND ( which is what the SELECT statment would look like when using two or more terms.
So it would appear the search term is something along the lines of "... FROM safari," testing this on geeklog.net causes an error. I've just commited a
patch[*1] that should fix the issue.