WordPress.org

Support

Support » Plugins and Hacks » [Plugin: Search Everything] SQL syntax error

[Plugin: Search Everything] SQL syntax error

  • I’m using WP 2.8.4., I just installed SE 6.3.1. If I set any of the SE “Basic Configuration” switches to “YES”, I get the following error when I try to run a search:

    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 'ND wp_posts.post_type = 'post' AND (wp_posts.post_status = 'publish')) AND post_' at line 1 for query  SELECT DISTINCT SQL_CALC_FOUND_ROWS  wp_posts.* FROM wp_posts  LEFT JOIN wp_comments AS cmt ON ( cmt.comment_post_ID = ID )  WHERE 1=1 AND ( wp_posts.post_type = 'post' AND (wp_posts.post_status = 'publish' OR ((cmt.comment_content LIKE '%delete%')) )ND wp_posts.post_type = 'post' AND (wp_posts.post_status = 'publish')) AND post_type != 'revision'  ORDER BY wp_posts.post_date DESC LIMIT 0, 5 made by require, require_once, include, get_header, locate_template, load_template, require_once, get_sidebar, locate_template, load_template, require_once, dynamic_sidebar, call_user_func_array, WP_Widget->display_callback, WP_Widget_Recent_Posts->widget, WP_Query->WP_Query, WP_Query->query, WP_Query->get_posts

    What is going on?

    http://wordpress.org/extend/plugins/search-everything/

Viewing 5 replies - 1 through 5 (of 5 total)
  • I am getting the same error.

    Hopefully the author will chime in here soon as the way that the request is assembled is fairly complex (lot’s of string replacement, etc.) … and I’m having trouble tracking down the error.

    Basically, there is something going on w/ the assembly of the request. I’ve tried to tinker with some of the index values … but no luck.

    The issue is with the value of $index3 on the $lastPart substr() extract.

    So…here is my horrible hack. Around line 190 in search-everything.php

    if ($searchQuery != '')
    		{
    			$index1 = strpos($where, '((');
    			$index2 = strrpos($where, '))');
    			$firstPart = substr($where, 0, $index1);
    			$secondPart = substr($where, $index1, $index2-1);
    			$lastPart = substr($where, $index2-1+3);
    			if ($lastPart = 'ND wp_posts.post_type = \'post\' AND (wp_posts.post_status = \'publish\')') { $lastPart = 'AND wp_posts.post_type = \'post\' AND (wp_posts.post_status = \'publish\')';}
    			$where = $firstPart."(".$secondPart.$searchQuery.")".$lastPart;
    
    		}

    That’s right, I actually hard code the replacement.

    Hello,

    I made some tests but I wasn’t able to reproduce the error.
    Do you have other plugins activated into you WordPress ?

    Regards,
    Eric

    Mike V

    @vander25

    I am also getting this error. Any more information on this?

    I am also getting this error. I have a lot of posts in my db (over 50k) so that could be part of the problem. Maybe it makes the list of ID’s so long that it can’t all be processed or something.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘[Plugin: Search Everything] SQL syntax error’ is closed to new replies.
Skip to toolbar