Support » Plugin: Slimstat Analytics » You have an error in your SQL syntax

  • I have started receiving an error message which seems to be linked to Slimstats, when I am in the admin interface for the Events Manager plugin (https://wordpress.org/plugins/events-manager/).

    This is the error:

    <p class="wpdberror"><strong>Errore sul database di WordPress:</strong> [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 ') AND dt BETWEEN 1581811200 AND 1584387002
    			GROUP BY resource
    			LIMIT 0, 1000' at line 3]<br><code>
    			SELECT resource, COUNT( DISTINCT id ) as counthits 
    			FROM ntzmv__slim_stats
    			WHERE () AND dt BETWEEN 1581811200 AND 1584387002
    			GROUP BY resource
    			LIMIT 0, 1000</code></p>

    The error only appears when my “future events” are empty. If I open the “past events” (which is not empty) I no longer see the error. If I create a new future event and save it as a draft, the list of “future events” is no longer empty and I don’t see the error. But if I delete this future event, and the list is empty again, I again see the error.

    I have tried force refreshing the page to make sure there weren’t old scripts in browser cache. I also have “Disable cache (while DevTools is open)” checked in my Chrome Developer Console, so I can’t have an old cached script.

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Contributor toxicum

    (@toxicum)

    I was able to reproduce, when Slimstat option “Posts and Pages” is on.
    It causes the plugin to fail completely here, so the Slimstat menu item disappears.
    I will try to find a fix for it.

    One workaround for you is, to disable the option “Posts and Pages”, either in the admin backend, or if not available, in the db directly in wp_options key “slimstat_options”.

    Plugin Contributor toxicum

    (@toxicum)

    Found a workaround (fix?):

    IN admin/index.php of the plugin, change line 737 from

    if ( empty( self::$data_for_column ) ) {

    to:

    if ( empty( self::$data_for_column ) || empty( self::$data_for_column[ 'url' ] ) ) {

    • This reply was modified 2 years, 8 months ago by toxicum.
    • This reply was modified 2 years, 8 months ago by toxicum.
    • This reply was modified 2 years, 8 months ago by toxicum.
    Plugin Contributor toxicum

    (@toxicum)

    So the block reads like:

    if ( empty( self::$data_for_column ) || empty( self::$data_for_column[ ‘url’ ] ) ) {
    return 0;
    }

    Plugin Contributor toxicum

    (@toxicum)

    If you like, you can replace admin/index.php with the fixed one from the PR:

    https://raw.githubusercontent.com/slimstat/wp-slimstat/faebeeff89c37ca1ce1a40f22d1ab8048264308f/admin/index.php

    See https://github.com/slimstat/wp-slimstat/pull/5

    • This reply was modified 2 years, 8 months ago by toxicum.
    Thread Starter JohnRDOrazio (CLPTE)

    (@lwangaman)

    IN admin/index.php of the plugin, change line 737 from

    if ( empty( self::$data_for_column ) ) {

    to:

    if ( empty( self::$data_for_column ) || empty( self::$data_for_column[ ‘url’ ] ) ) {

    I can confirm that this fixes the issue.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘You have an error in your SQL syntax’ is closed to new replies.