WordPress.org

Ready to get started?Download WordPress

Forums

Database error when searching (9 posts)

  1. volfreak
    Member
    Posted 6 years ago #

    I just noticed that when I search for a term that includes an apostrophe I get an error. Anyone else have this issue? I just upgraded to the latest version last night but I honestly don't know if I had this problem before or not.

  2. whooami
    Member
    Posted 6 years ago #

    there were posts on that some time ago, but I believe it's long since resolved. I can't duplicate it on my 2.2 install.

    Are you using any search related plugins???

  3. volfreak
    Member
    Posted 6 years ago #

    no search related plugins.

  4. volfreak
    Member
    Posted 6 years ago #

    I even tried disabling all plugins just to be sure.

    here is the error:

    when searching for let's see

    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 see%' GROUP BY ID ORDER BY post_date DESC LIMIT 0, 10' at line 1]
    SELECT SQL_CALC_FOUND_ROWS wp_posts.* FROM wp_posts LEFT JOIN wp_post2tag p2t on wp_posts.ID = p2t.post_id INNER JOIN wp_tags on p2t.tag_id = wp_tags.tag_id WHERE 1=1 AND (((post_title LIKE '%let\'s%') OR (post_content LIKE '%let\'s%')) AND ((post_title LIKE '%see%') OR (post_content LIKE '%see%')) OR (post_title LIKE '%let\'s see%') OR (post_content LIKE '%let\'s see%')) AND (post_type = 'post' AND (post_status = 'publish' OR post_status = 'private')) OR wp_tags.tag like '%let's see%' GROUP BY ID ORDER BY post_date DESC LIMIT 0, 10

  5. pawoodster
    Member
    Posted 6 years ago #

    I also seem to be getting the same error when I search for something including an apostrophe:

    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 't%' GROUP BY ID ORDER BY post_date DESC' at line 1]
    SELECT wp_posts.* FROM wp_posts LEFT JOIN wp_post2tag p2t on wp_posts.ID = p2t.post_id INNER JOIN wp_tags on p2t.tag_id = wp_tags.tag_id WHERE 1=1 AND (((post_title LIKE '%don\'t%') OR (post_content LIKE '%don\'t%'))) AND (post_type = 'post' AND (post_status = 'publish' OR post_status = 'future' OR post_status = 'draft' OR post_status = 'private')) OR wp_tags.tag like '%don't%' GROUP BY ID ORDER BY post_date DESC

    I've just upgraded from 2.1.1 to 2.2 and that didn't change anything.

    Cheers.

  6. yonbeastie
    Member
    Posted 6 years ago #

    I am having the same problem. I believe it has something to do with Ultimate Tag Warrior because the error comes from an improperly escaped ' by wp_tags.tag (etc). When I inactive UTW, search appears to work perfectly.

    Now if I could just find the spot in UTW or WP's code to catch this pesky bug, we'd be in business. Please post if anybody finds something.

  7. tlongren
    Member
    Posted 6 years ago #

    This is definitely a problem related to UTW. It's not escaping the single quote when searching the tags. Anyone ever come up with a fix for this?

    EDIT: Nevermind, the latest version of UTW fixes this, didn't realize I was on an old version.

  8. therapyindex
    Member
    Posted 6 years ago #

    I have the word Grauman's in a post. If I search for Grauman's I get 'no results found'. However, if I repeat the search omitting the letter after the apostrophe (eg Grauman'), the search term is found.

    I don't have any plugins.

    How can I correct this?

  9. whooami
    Member
    Posted 6 years ago #

    therapyindex,

    I can duplicate your problem on another install. However, it appears the svn takes care of that since it works with the 's on my experimental blog.

Topic Closed

This topic has been closed to new replies.

About this Topic