Title: [Plugin: Search Everything] SQL syntax error
Last modified: August 19, 2016

---

# [Plugin: Search Everything] SQL syntax error

 *  [DataGnostics](https://wordpress.org/support/users/datagnostics/)
 * (@datagnostics)
 * [16 years, 9 months ago](https://wordpress.org/support/topic/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/](http://wordpress.org/extend/plugins/search-everything/)

Viewing 5 replies - 1 through 5 (of 5 total)

 *  [mitchell360](https://wordpress.org/support/users/hogayoga/)
 * (@hogayoga)
 * [16 years, 8 months ago](https://wordpress.org/support/topic/plugin-search-everything-sql-syntax-error/#post-1213715)
 * 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.
 *  [mitchell360](https://wordpress.org/support/users/hogayoga/)
 * (@hogayoga)
 * [16 years, 8 months ago](https://wordpress.org/support/topic/plugin-search-everything-sql-syntax-error/#post-1213716)
 * 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.
 *  [elebail](https://wordpress.org/support/users/elebail/)
 * (@elebail)
 * [16 years, 7 months ago](https://wordpress.org/support/topic/plugin-search-everything-sql-syntax-error/#post-1213717)
 * 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
 *  [vander25](https://wordpress.org/support/users/vander25/)
 * (@vander25)
 * [16 years, 6 months ago](https://wordpress.org/support/topic/plugin-search-everything-sql-syntax-error/#post-1213726)
 * I am also getting this error. Any more information on this?
 *  [Jer Clarke](https://wordpress.org/support/users/jeremyclarke/)
 * (@jeremyclarke)
 * [16 years ago](https://wordpress.org/support/topic/plugin-search-everything-sql-syntax-error/#post-1213747)
 * 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.

 * 5 replies
 * 5 participants
 * Last reply from: [Jer Clarke](https://wordpress.org/support/users/jeremyclarke/)
 * Last activity: [16 years ago](https://wordpress.org/support/topic/plugin-search-everything-sql-syntax-error/#post-1213747)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
