Title: PHP MYSQL errors
Last modified: April 13, 2017

---

# PHP MYSQL errors

 *  Resolved [internationils](https://wordpress.org/support/users/internationils/)
 * (@internationils)
 * [8 years, 12 months ago](https://wordpress.org/support/topic/php-mysql-errors/)
 * [09-Apr-2017 06:16:10 UTC] 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 ‘searchterms <> “” AND searchterms <> “_” AND referer
   NOT LIKE “%mysite.net%” AN’ at line 3 for query
    SELECT REPLACE( SUBSTRING_INDEX(
   SUBSTRING_INDEX( SUBSTRING_INDEX( referer, “://”, -1 ), “/”, 1 ), “.”, -5 ), “
   www.”, “” ) AS referer_calculated, COUNT(*) counthits FROM wpTABLE_slim_stats
   WHERE searchterms IS NOT NULL searchterms <> “” AND searchterms <> “_” AND referer
   NOT LIKE “%mysite.net%” AND dt BETWEEN 1491004800 AND 1491722168 GROUP BY referer_calculated
   ORDER BY counthits DESC LIMIT 0, 1000 made by wp_dashboard, do_meta_boxes, call_user_func,
   wp_slimstat_reports::callback_wrapper, call_user_func, wp_slimstat_reports::raw_results_to_html,
   call_user_func, wp_slimstat_db::get_top, wp_slimstat_db::get_results [12-Apr-
   2017 05:41:32 UTC] 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 ‘searchterms <> “” AND searchterms <> “_” AND referer NOT 
   LIKE “%myothersite’ at line 3 for query SELECT REPLACE( SUBSTRING_INDEX( SUBSTRING_INDEX(
   SUBSTRING_INDEX( referer, “://”, -1 ), “/”, 1 ), “.”, -5 ), “www.”, “” ) AS referer_calculated,
   COUNT(*) counthits FROM TABLE2_slim_stats WHERE searchterms IS NOT NULL searchterms
   <> “” AND searchterms <> “_” AND referer NOT LIKE “%myothersite.com%” AND dt 
   BETWEEN 1491004800 AND 1491979290 GROUP BY referer_calculated ORDER BY counthits
   DESC LIMIT 0, 1000 made by wp_dashboard, do_meta_boxes, call_user_func, wp_slimstat_reports::
   callback_wrapper, call_user_func, wp_slimstat_reports::raw_results_to_html, call_user_func,
   wp_slimstat_db::get_top, wp_slimstat_db::get_results

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

 *  Thread Starter [internationils](https://wordpress.org/support/users/internationils/)
 * (@internationils)
 * [8 years, 12 months ago](https://wordpress.org/support/topic/php-mysql-errors/#post-9025959)
 * I received this error in my PHP logs on two separate sites, both running the 
   latest WP and Slimstat.
 *  [Saša](https://wordpress.org/support/users/stodorovic/)
 * (@stodorovic)
 * [8 years, 12 months ago](https://wordpress.org/support/topic/php-mysql-errors/#post-9026327)
 * I just confirmed that’s bug in the code. I see same errors.
 *     ```
       [10-Apr-2017 14:20:57 UTC] 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 'searchterms <> "" AND searchterms <> "_" AND referer NOT LIKE "%xxxxx.com%" AN' at line 3 for query 
                               SELECT REPLACE( SUBSTRING_INDEX( SUBSTRING_INDEX( SUBSTRING_INDEX( referer, "://", -1 ), "/", 1 ), ".", -5 ), "www.", "" ) AS referer_calculated, COUNT(*) counthits
                               FROM wp_slim_stats
                               WHERE searchterms IS NOT NULL searchterms <> "" AND searchterms <> "_" AND referer NOT LIKE "%xxxxx.com%" AND dt BETWEEN 1491004800 AND 1491834054
                               GROUP BY referer_calculated 
                               ORDER BY counthits DESC
                               LIMIT 0, 1000 made by wp_dashboard, do_meta_boxes, call_user_func, wp_slimstat_reports::callback_wrapper, call_user_func, wp_slimstat_reports::raw_results_to_html, call_user_func, wp_slimstat_db::get_top, wp_slimstat_db::get_results
       ```
   
 * **File: admin/view/wp-slimstat-reports.php Line: 554**
 * `'where' => 'searchterms IS NOT NULL searchterms <> ""`
 * it should be
 * `'where' => 'searchterms IS NOT NULL AND searchterms <> ""`
 *  Plugin Contributor [Jason Crouse](https://wordpress.org/support/users/coolmann/)
 * (@coolmann)
 * [8 years, 11 months ago](https://wordpress.org/support/topic/php-mysql-errors/#post-9029035)
 * Please see:
 * [https://wordpress.org/support/topic/blacklist-does-not-work-after-the-todays-update-4-6-4/](https://wordpress.org/support/topic/blacklist-does-not-work-after-the-todays-update-4-6-4/)
 * Best,
    Jason
 *  Thread Starter [internationils](https://wordpress.org/support/users/internationils/)
 * (@internationils)
 * [8 years, 11 months ago](https://wordpress.org/support/topic/php-mysql-errors/#post-9029438)
 * Hi Jason, thanks… I didn’t see any mention of PHP errors in that bug so I had
   no idea it was the same issue.
 *  Plugin Contributor [Jason Crouse](https://wordpress.org/support/users/coolmann/)
 * (@coolmann)
 * [8 years, 11 months ago](https://wordpress.org/support/topic/php-mysql-errors/#post-9039176)
 * If you read the error, it says it’s an SQL error, not a PHP error. However, this
   is now solved in version 4.6.5. Please upgrade.
 * Best,
    Jason

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

The topic ‘PHP MYSQL errors’ is closed to new replies.

 * ![](https://ps.w.org/wp-slimstat/assets/icon.svg?rev=2832242)
 * [SlimStat Analytics](https://wordpress.org/plugins/wp-slimstat/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wp-slimstat/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wp-slimstat/)
 * [Active Topics](https://wordpress.org/support/plugin/wp-slimstat/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wp-slimstat/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wp-slimstat/reviews/)

## Tags

 * [MySQL](https://wordpress.org/support/topic-tag/mysql/)

 * 5 replies
 * 3 participants
 * Last reply from: [Jason Crouse](https://wordpress.org/support/users/coolmann/)
 * Last activity: [8 years, 11 months ago](https://wordpress.org/support/topic/php-mysql-errors/#post-9039176)
 * Status: resolved