• Resolved tremaine

    (@tremaine)


    I just upgraded WP 1.5.1.2 to 1.5.1.3 (after backing up the entire directory and mysql db of course!) and can no longer post via email to my blog at http://blog.ddiction.com/

    I get the following errors when going using wp-mail.php

    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 a very odd experience to see your arm and hand responding co]
    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 ('3', '2005-07-09 20:28:57', '2005-07-10 03:28:57', '2005-07-09 20:28:57', '2005-07-10 03:28:57', '

    This is then followed by the content of the email post, then followed by more errors

    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 '' at line 3]
    SELECT category_id FROM wp_post2cat WHERE post_id =

    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 ' 1)' at line 2]
    INSERT INTO wp_post2cat (post_id, category_id) VALUES (, 1)

    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 '' at line 1]
    SELECT pinged FROM wp_posts WHERE ID =

    Any mysql gurus out there know what’s happening here and how I can fix it? I can still post normally from within the admin interface, but I use the wp-mail function because I post to multiple places at the same time via email.

Viewing 15 replies - 1 through 15 (of 24 total)
  • Thread Starter tremaine

    (@tremaine)

    Ok… I have no idea what just happened, but I sent a test message to my blogs email address… and it posted with no errors at all.

    I suppose my mail client (Evolution) may have sent the original message with errors… Bizarre.

    Thread Starter tremaine

    (@tremaine)

    It appears this is going to be an ongoing and intermittent problem. I made another post with substantive content (rather than a single line test post) via email and the error recurred.

    Did you ever get this fixed? As I am having the same issue on the Blog on run, its giving me the same output. I am running MySQL 4.1

    I did a complete re-install of my WordPress thinking it might be an issue with the actual MySQL Version, but still receiving the same error on posting from an e-mail source.

    Thread Starter tremaine

    (@tremaine)

    Still unresolved unfortunately… it’s annoying as hell.

    Thread Starter tremaine

    (@tremaine)

    Any WordPress gurus out here watching this thread at all? I have root access on the server this is occurring on and I’d be happy to provide service versions and enable debugging to help track this sucker down.

    Apache/2.0.54
    PHP 4.4.0 (cli)
    Zend Engine v1.3.0
    mysql Ver 12.22 Distrib 4.0.24, for pc-linux-gnu (i686)

    from mysql.log when going using wp-mail.php (edited to remove email addresses)


    2 Init DB blog-ddiction
    2 Query SELECT * FROM wp_users WHERE user_level > 0
    050724 18:57:43 2 Query SELECT option_name, option_value FROM wp_options WHERE autol oad = 'yes'
    1 Query SELECT username, crypt, "", uid, gid, pop, "", "", realname, "" FROM users WHERE username = "removed"
    2 Query SELECT ID FROM wp_users WHERE user_email='removed ' ORDER BY ID DESC LIMIT 1
    2 Query SELECT option_value FROM wp_options WHERE option_name = 'sub jectprefix'
    2 Query SELECT post_name FROM wp_posts WHERE post_name = 'cuz-im-a-m eme-whore-and-my-brain-is-fried-from-working-over-the' AND post_status = 'publish' AND ID != '' LIMIT 1
    2 Query INSERT INTO wp_posts
    (post_author, post_date, post_date_gmt, post_modified, post_modified_gmt, post_c ontent, post_title, post_excerpt, post_category, post_status, post_name, comment_status, ping_st atus, post_parent)
    VALUES ('3', '2005-07-24 17:43:11', '2005-07-25 00:43:11', '2005-07-24 17:43:11' , '2005-07-25 00:43:11', 'Congratulations on being the creator of a new
    Evil Plan (tm)!
    Your objective is simple: World Domination.

    Your motive is a little bit more complex: Power

    Stage One
    To begin your plan, you must first assassinate a pope. This will
    cause the world to whisper among themselves, alarmed by your
    arrival. Who is this despoiler of all that is good and nice and
    true? Where did they come from? And why do they look so good in
    a corporate suit?

    Stage Two
    Next, you must seize control of the Internet. This will all be
    done from a obsidian citadel, a mysterious place of unrivaled
    dark glory. Upon seeing this, the world will gibber like madmen,
    as countless hordes of computer programmers hasten to do your
    every bidding.

    Stage Three
    Finally, you must prepare your corporate takeover, bringing
    about a 1984 police state. Your name shall become synonymous
    with fear, and no man will ever again dare cross you. Everyone
    will bow before your cunning intelligence, and the world will
    have no choice but to whisper your name in fear.', 'Cuz I'm a meme whore, and my brain i s fried from working over the', '', '1', 'publish', 'cuz-im-a-meme-whore-and-my-brain-is-fried-f rom-working-over-the', 'open', 'open', '0')
    2 Query UPDATE wp_posts SET guid = 'http://blog.ddiction.com/?p=' WH ERE ID = ''
    2 Query SELECT category_id
    FROM wp_post2cat
    WHERE post_id =
    2 Query INSERT INTO wp_post2cat (post_id, category_id)
    VALUES (, 1)

    If there is anything else I can provide that would help troubleshoot this, let me know.

    Thread Starter tremaine

    (@tremaine)

    To provide some comparison, when posting via the web interface the mysql.log shows this. Same content as from the email post that failed.


    2 Init DB blog-ddiction
    2 Query SELECT * FROM wp_users WHERE user_level > 0
    2 Query SELECT option_name, option_value FROM wp_options WHERE autoload = 'yes'
    2 Query SELECT ID, user_login, user_pass FROM wp_users WHERE user_login = 'admin'
    2 Query SELECT * FROM wp_categories
    2 Query SELECT COUNT(*) FROM wp_comments WHERE comment_approved = '0'
    2 Query SHOW TABLE STATUS LIKE 'wp_posts'
    2 Query SELECT post_name FROM wp_posts WHERE post_name = 'cuz-im-a-meme-whore-and-my-brain-is-fried-from-working-over-the-weekend' AND post_status = 'publish' AND ID != '943' LIMIT 1
    2 Query INSERT INTO wp_posts
    (ID, post_author, post_date, post_date_gmt, post_content, post_title, post_excerpt, post_status, comment_status, ping_status, post_password, post_name, to_ping, post_modified, post_modified_gmt, post_parent, menu_order)
    VALUES
    ('943', '1', '2005-07-24 18:08:33', '2005-07-25 01:08:33', 'Congratulations on being the creator of a new
    Evil Plan (tm)!
    Your objective is simple: World Domination.

    Your motive is a little bit more complex: Power

    Stage One
    To begin your plan, you must first assassinate a pope. This will
    cause the world to whisper among themselves, alarmed by your
    arrival. Who is this despoiler of all that is good and nice and
    true? Where did they come from? And why do they look so good in
    a corporate suit?

    Stage Two
    Next, you must seize control of the Internet. This will all be
    done from a obsidian citadel, a mysterious place of unrivaled
    dark glory. Upon seeing this, the world will gibber like madmen,
    as countless hordes of computer programmers hasten to do your
    every bidding.

    Stage Three
    Finally, you must prepare your corporate takeover, bringing
    about a 1984 police state. Your name shall become synonymous
    with fear, and no man will ever again dare cross you. Everyone
    will bow before your cunning intelligence, and the world will
    have no choice but to whisper your name in fear. ', 'Cuz I\'m a meme whore, and my brain is fried from working over the weekend', '', 'publish', 'open', 'open', '', 'cuz-im-a-meme-whore-and-my-brain-is-fried-from-working-over-the-weekend', '', '2005-07-24 18:08:33', '2005-07-25 01:08:33', '0', '0')
    2 Query SELECT * FROM wp_post2cat WHERE post_id = 943 AND category_id = 1
    2 Query INSERT INTO wp_post2cat
    (post_id, category_id)
    VALUES
    (943, 1)
    2 Query SELECT * FROM wp_posts WHERE ID=943
    2 Query UPDATE wp_posts SET guid = 'http://blog.ddiction.com/?p=943' WHERE ID = '943'
    050724 19:08:35 3 Connect username@localhost on
    3 Init DB blog-ddiction
    3 Query SELECT * FROM wp_users WHERE user_level > 0
    3 Query SELECT option_name, option_value FROM wp_options WHERE autoload = 'yes'
    3 Query SELECT * FROM wp_categories
    3 Query SELECT DISTINCT * FROM wp_posts WHERE 1=1 AND post_date_gmt <= '2005-07-25 01:08:59' AND (post_status = "publish" OR post_author = 3 AND post_status != 'draft' AND post_status != 'static') GROUP BY wp_posts.ID ORDER BY post_date DESC LIMIT 0, 10
    3 Query SELECT DISTINCT
    post_id, cat_ID FROM wp_categories, wp_post2cat
    WHERE category_id = cat_ID AND post_id IN (943,942,941,939,938,937,936,935,934,933)
    3 Query SELECT ID, COUNT( comment_ID ) AS ccount
    FROM wp_posts
    LEFT JOIN wp_comments ON ( comment_post_ID = ID AND comment_approved = '1')
    WHERE ID IN (943,942,941,939,938,937,936,935,934,933)
    GROUP BY ID
    3 Query SELECT post_id, meta_key, meta_value FROM wp_postmeta WHERE post_id IN(943,942,941,939,938,937,936,935,934,933) ORDER BY post_id, meta_key
    3 Query SELECT DISTINCT YEAR(post_date) AS year, MONTH(post_date) AS month, count(ID) as posts FROM wp_posts WHERE post_date < ‘2005-07-24 18:08:35’ AND post_status = ‘publish’ GROUP BY YEAR(post_date), MONTH(post_date) ORDER BY post_date DESC
    050724 19:08:36 3 Query SELECT * FROM wp_posts WHERE post_status = ‘static’ ORDER BY post_title ASC
    3 Query SELECT DISTINCT YEAR(post_date) AS year, MONTH(post_date) AS month, count(ID) as posts FROM wp_posts WHERE post_date < ‘2005-07-24 18:08:36’ AND post_status = ‘publish’ GROUP BY YEAR(post_date), MONTH(post_date) ORDER BY post_date DESC
    3 Query SELECT cat_ID, cat_name, category_nicename, category_description, category_parent
    FROM wp_categories
    WHERE cat_ID > 0
    ORDER BY cat_id asc
    3 Query SELECT cat_ID,
    COUNT(wp_post2cat.post_id) AS cat_count
    FROM wp_categories
    INNER JOIN wp_post2cat ON (cat_ID = category_id)
    INNER JOIN wp_posts ON (ID = post_id)
    WHERE post_status = ‘publish’
    AND post_date_gmt < ‘2005-07-25 01:08:36’
    GROUP BY category_id
    3 Query SELECT option_value FROM wp_options WHERE option_name = ‘blogfilename’
    3 Query SELECT cat_id, cat_name, auto_toggle, show_images, show_description, show_rating, show_updated, sort_order, sort_desc, text_before_link, text_after_link, text_after_all, list_limit FROM wp_linkcategories WHERE cat_id=1
    3 Query SELECT link_url, link_name, link_image, link_target,
    link_description, link_rating, link_rel , IF (DATE_ADD(link_updated, INTERVAL 120 MINUTE) >= NOW(), 1,0) as recently_updated , UNIX_TIMESTAMP(link_updated) AS link_updated_f
    FROM wp_links
    WHERE link_visible = ‘Y’ AND link_category = 1 ORDER BY rand() ASC
    3 Query SELECT COUNT(ID) FROM wp_posts WHERE 1=1 AND post_date_gmt <= ‘2005-07-25 01:08:59’ AND (post_status = “publish” OR post_author = 3 AND post_status != ‘draft’ AND post_status != ‘static’)
    3 Quit
    050724 19:08:49 1 Query SELECT username, crypt, “”, uid, gid, pop, “”, “”, realname, “” FROM users WHERE username = “hcarrigan@allcan.com”
    4 Connect username@localhost on
    4 Init DB blog-ddiction
    4 Query SELECT * FROM wp_users WHERE user_level > 0
    4 Query SELECT option_name, option_value FROM wp_options WHERE autoload = ‘yes’
    4 Query SELECT * FROM wp_categories
    4 Query SELECT DISTINCT * FROM wp_posts WHERE 1=1 AND post_date_gmt <= ‘2005-07-25 01:08:59’ AND (post_status = “publish” OR post_author = 1 AND post_status != ‘draft’ AND post_status != ‘static’) GROUP BY wp_posts.ID ORDER BY post_date DESC LIMIT 0, 10
    4 Query SELECT DISTINCT
    post_id, cat_ID FROM wp_categories, wp_post2cat
    WHERE category_id = cat_ID AND post_id IN (943,942,941,939,938,937,936,935,934,933)
    4 Query SELECT ID, COUNT( comment_ID ) AS ccount
    FROM wp_posts
    LEFT JOIN wp_comments ON ( comment_post_ID = ID AND comment_approved = ‘1’)
    WHERE ID IN (943,942,941,939,938,937,936,935,934,933)
    GROUP BY ID
    4 Query SELECT post_id, meta_key, meta_value FROM wp_postmeta WHERE post_id IN(943,942,941,939,938,937,936,935,934,933) ORDER BY post_id, meta_key
    4 Query SELECT DISTINCT YEAR(post_date) AS year, MONTH(post_date) AS month, count(ID) as posts FROM wp_posts WHERE post_date < ‘2005-07-24 18:08:49’ AND post_status = ‘publish’ GROUP BY YEAR(post_date), MONTH(post_date) ORDER BY post_date DESC
    4 Query SELECT * FROM wp_posts WHERE post_status = ‘static’ ORDER BY post_title ASC
    4 Query SELECT DISTINCT YEAR(post_date) AS year, MONTH(post_date) AS month, count(ID) as posts FROM wp_posts WHERE post_date < ‘2005-07-24 18:08:49’ AND post_status = ‘publish’ GROUP BY YEAR(post_date), MONTH(post_date) ORDER BY post_date DESC
    4 Query SELECT cat_ID, cat_name, category_nicename, category_description, category_parent
    FROM wp_categories
    WHERE cat_ID > 0
    ORDER BY cat_id asc
    4 Query SELECT cat_ID,
    COUNT(wp_post2cat.post_id) AS cat_count
    FROM wp_categories
    INNER JOIN wp_post2cat ON (cat_ID = category_id)
    INNER JOIN wp_posts ON (ID = post_id)
    WHERE post_status = ‘publish’
    AND post_date_gmt < ‘2005-07-25 01:08:49’
    GROUP BY category_id
    4 Query SELECT option_value FROM wp_options WHERE option_name = ‘blogfilename’
    4 Query SELECT cat_id, cat_name, auto_toggle, show_images, show_description, show_rating, show_updated, sort_order, sort_desc, text_before_link, text_after_link, text_after_all, list_limit FROM wp_linkcategories WHERE cat_id=1
    4 Query SELECT link_url, link_name, link_image, link_target,
    link_description, link_rating, link_rel , IF (DATE_ADD(link_updated, INTERVAL 120 MINUTE) >= NOW(), 1,0) as recently_updated , UNIX_TIMESTAMP(link_updated) AS link_updated_f
    FROM wp_links
    WHERE link_visible = ‘Y’ AND link_category = 1 ORDER BY rand() ASC
    4 Query SELECT COUNT(ID) FROM wp_posts WHERE 1=1 AND post_date_gmt <= ‘2005-07-25 01:08:59’ AND (post_status = “publish” OR post_author = 1 AND post_status != ‘draft’ AND post_status != ‘static’)
    4 Quit
    050724 19:08:52 5 Connect username@localhost on
    5 Init DB blog-ddiction
    5 Query SELECT * FROM wp_users WHERE user_level > 0
    5 Query SELECT option_name, option_value FROM wp_options WHERE autoload = ‘yes’
    5 Query SELECT * FROM wp_categories
    5 Query SELECT DISTINCT * FROM wp_posts WHERE 1=1 AND post_date_gmt <= ‘2005-07-25 01:08:59’ AND (post_status = “publish” OR post_author = 3 AND post_status != ‘draft’ AND post_status != ‘static’) GROUP BY wp_posts.ID ORDER BY post_date DESC LIMIT 0, 10
    5 Query SELECT DISTINCT
    post_id, cat_ID FROM wp_categories, wp_post2cat
    WHERE category_id = cat_ID AND post_id IN (943,942,941,939,938,937,936,935,934,933)
    5 Query SELECT ID, COUNT( comment_ID ) AS ccount
    FROM wp_posts
    LEFT JOIN wp_comments ON ( comment_post_ID = ID AND comment_approved = ‘1’)
    WHERE ID IN (943,942,941,939,938,937,936,935,934,933)
    GROUP BY ID
    5 Query SELECT post_id, meta_key, meta_value FROM wp_postmeta WHERE post_id IN(943,942,941,939,938,937,936,935,934,933) ORDER BY post_id, meta_key
    5 Query SELECT DISTINCT YEAR(post_date) AS year, MONTH(post_date) AS month, count(ID) as posts FROM wp_posts WHERE post_date < ‘2005-07-24 18:08:52’ AND post_status = ‘publish’ GROUP BY YEAR(post_date), MONTH(post_date) ORDER BY post_date DESC
    050724 19:08:53 5 Query SELECT * FROM wp_posts WHERE post_status = ‘static’ ORDER BY post_title ASC
    5 Query SELECT DISTINCT YEAR(post_date) AS year, MONTH(post_date) AS month, count(ID) as posts FROM wp_posts WHERE post_date < ‘2005-07-24 18:08:53’ AND post_status = ‘publish’ GROUP BY YEAR(post_date), MONTH(post_date) ORDER BY post_date DESC
    5 Query SELECT cat_ID, cat_name, category_nicename, category_description, category_parent
    FROM wp_categories
    WHERE cat_ID > 0
    ORDER BY cat_id asc
    5 Query SELECT cat_ID,
    COUNT(wp_post2cat.post_id) AS cat_count
    FROM wp_categories
    INNER JOIN wp_post2cat ON (cat_ID = category_id)
    INNER JOIN wp_posts ON (ID = post_id)
    WHERE post_status = ‘publish’
    AND post_date_gmt < ‘2005-07-25 01:08:53’
    GROUP BY category_id
    5 Query SELECT option_value FROM wp_options WHERE option_name = ‘blogfilename’
    5 Query SELECT cat_id, cat_name, auto_toggle, show_images, show_description, show_rating, show_updated, sort_order, sort_desc, text_before_link, text_after_link, text_after_all, list_limit FROM wp_linkcategories WHERE cat_id=1
    5 Query SELECT link_url, link_name, link_image, link_target,
    link_description, link_rating, link_rel , IF (DATE_ADD(link_updated, INTERVAL 120 MINUTE) >= NOW(), 1,0) as recently_updated , UNIX_TIMESTAMP(link_updated) AS link_updated_f
    FROM wp_links
    WHERE link_visible = ‘Y’ AND link_category = 1 ORDER BY rand() ASC
    5 Query SELECT COUNT(ID) FROM wp_posts WHERE 1=1 AND post_date_gmt <= ‘2005-07-25 01:08:59’ AND (post_status = “publish” OR post_author = 3 AND post_status != ‘draft’ AND post_status != ‘static’)
    5 Quit

    Thread Starter tremaine

    (@tremaine)

    Ok, more information to add to this whole mess. I’ve been firing a pile of test messages to my blog via email with different criteria.

    It appears that the existence of a single apostrophe in the message or subject will break it.

    Email length and subject line length doesn’t matter.

    Now if only I knew enough about php and mysql to actually fix the problem.

    I tried it with and without the apostrophe and it is still dumping my post from the e-mail. I really hope a WordPress Delveoper is taking a look at this thread, as I really need a fix on this. Can someone please take a look here?

    Bumping this again for maybe a WordPress Guru to take a look at it.

    Thread Starter tremaine

    (@tremaine)

    I’ve created a ticket over here -> http://trac.wordpress.org/ticket/1536 to track this issue as well. Perhaps if a others chime in with bug reports we can get this looked at.

    Thread Starter tremaine

    (@tremaine)

    Giving this a half hearted bump as it appears noone who can help is watching either this thread, or the open bug ticket on it.

    Bumped your bug report up for the devs to see. Seems like an issue of the content just not being escaped.

    As a temporary fix for you, try adding this in a plugin (or at the top of wp-mail.php):


    add_filter('phone_content', 'addslashes');

    I added this line at the very top of the code and am still getting an error message now when attempting to call this script from a browser:

    Fatal error: Call to undefined function: add_filter() in /home/murphy/public_html/mind/wp-mail.php on line 2

    Make sure the add_filter line occurs after this:
    require(dirname(__FILE__) . '/wp-config.php');

Viewing 15 replies - 1 through 15 (of 24 total)
  • The topic ‘mysql errors with wp-mail after upgrade to 1.5.1.3 from 1.5.1.2’ is closed to new replies.