WordPress.org

Ready to get started?Download WordPress

Forums

[Plugin: Search Everything] SQL syntax error (6 posts)

  1. DataGnostics
    Member
    Posted 5 years ago #

    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/

  2. mitchell360
    Member
    Posted 4 years ago #

    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.

  3. mitchell360
    Member
    Posted 4 years ago #

    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.

  4. elebail
    Member
    Posted 4 years ago #

    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

  5. Mike V
    Member
    Posted 4 years ago #

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

  6. Jeremy Clarke
    Member
    Posted 4 years ago #

    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.

Topic Closed

This topic has been closed to new replies.

About this Topic