• 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.

Viewing 8 replies - 1 through 8 (of 8 total)
  • 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???

    Thread Starter volfreak

    (@volfreak)

    no search related plugins.

    Thread Starter volfreak

    (@volfreak)

    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

    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.

    Anonymous User 202350

    (@anonymized-202350)

    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.

    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.

    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?

    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.

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Database error when searching’ is closed to new replies.