Jump to content

Wp Sql Syntax Error -


black cat

Recommended Posts

Hello-

I've been receieving the following error message that relates to a post to my WordPress blog:

 

WordPress database 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 's = robots.txt file=20 which is placed at the root level:

INSERT INTO wp_posts (post_author, post_date, post_date_gmt, post_modified, post_modified_gmt, post_content, post_title, post_excerpt, post_category, post_status, post_name, comment_status, ping_status, post_parent) VALUES ('1', '2005-10-13 19:45:36', '2005-10-14 02:45:36', '2005-10-13 19:45:36', '2005-10-14 02:45:36', '

 

The line that reads "'s = robots.txt file=20 which is placed at the root level:" is part of the test in a post that was submitted a few days ago.

 

Support at WordPress suggests that one possible cause is if the PHP version on the host has been upgraded and the Zend Optimizer has not. I know not what this means but this is where I read it - http://wordpress.org/support/topic/18678

 

Can you folks tell me if this might be where my problem is?

Thanks so much for your time!-

Oh yeah, I'm on server 93

 

black cat

Link to comment
Share on other sites

It looks to me like you have a problem with WordPress not escaping quotes (as \') before sending the data to the MySQL database, which may be related to your magic_quotes_gpc PHP setting. Normally, magic_quotes_gpc is set to 'on' on TCH servers, but it can be turned off in an .htaccess file. You might take a look at your .htaccess files and see if 'php_flag magic_quotes_gpc' is being set in any of them either way (on or off).

Link to comment
Share on other sites

Thanks for the quick response guys, and for pointing me in the right direction!

I checked my htaccess file and don't see anything that looks like

magic_quotes_gpc PHP

 

However, the error is always triggered by the use of single quotes (or apostrophes) in posts submitted via e-mail. Other punctuation is not a problem. I found that some other folks were having the same problem in the WP Support Forum so I posted my ? there too.

 

Know of anywhere else I can check?

 

Thanks again!

Link to comment
Share on other sites

However, the error is always triggered by the use of single quotes (or apostrophes) in posts submitted via e-mail.

Posts submitted by e-mail are significantly different than posts submitted through a web browser: the text in an e-mail post does not get stored in PHP's $_GET, $_POST, or $_SERVER variables. Because of this, the 'magic_quotes_gpc' PHP setting would have no effect on an e-mail post - even if it is set to 'on', PHP would not automatically escape quotes in a post submitted by e-mail.

 

From what I can tell, this may be a bug in the wp-mail.php script (WP support topic, WP bug report). If I'm reading the bug report correctly, it's supposed to be fixed in WP 1.6.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...