WordPress.org

Ready to get started?Download WordPress

Forums

WPtap Mobile Detector
MYSQL error (3 posts)

  1. lamalama
    Member
    Posted 1 year ago #

    Hello!

    Our PHP error console gives the following errors:

    [10-Sep-2012 18:32:49 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 '' at line 1 for query SELECT theme_template,redirect FROM bb_md_mobilemeta WHERE mobile_id= made by require_once('wwwroot\wp-admin\admin.php'), require_once('wwwroot\wp-load.php'), require_once('wwwroot\wp-config.php'), require_once('wwwroot\wp-settings.php'), include_once('wwwroot\wp-content\plugins\wptap-mobile-detector\mobiledetector.php'), mobileDetect

    I think it happens when no mobile device is detected. Does it is bad or no problem that this error happens? Thank you!

    http://wordpress.org/extend/plugins/wptap-mobile-detector/

  2. messiahneo
    Member
    Posted 1 year ago #

    Hey, whats up...

    I had the same issue as you... after I updated my WP both front and backend it stoped working.

    I debugged the code and change only one line and works fine for me.

    On wptap-mobile-detector/md-includes/function.php

    I changed "mobileDetect()" function and put only a if clause.

    if($mobile_current_id!=NULL){
    		$mobilemeta = $wpdb->get_row("SELECT theme_template,redirect FROM ".TABLE_MOBILEMETA." WHERE mobile_id=".$mobile_current_id);
    
    		if($mobilemeta->redirect) {
    			header("Location: $mobilemeta->redirect");
    			exit;
    		}
    
    		return $mobilemeta->theme_template;
    	}

    Maybe will help you too...

  3. Marco
    Member
    Posted 1 year ago #

    Thank you for the hint. Here is our adjustment:

    if(is_numeric($mobile_current_id) && $mobile_current_id >= 1 && $mobile_current_id <= 9){
    		$mobilemeta = $wpdb->get_row("SELECT <code>theme_template</code>,<code>redirect</code> FROM <code>".TABLE_MOBILEMETA."</code> WHERE <code>mobile_id</code>=$mobile_current_id");
    
    		if($mobilemeta->redirect) {
    			header("Location: $mobilemeta->redirect");
    			exit;
    		}
    
    		return $mobilemeta->theme_template;
    	}
    	return null;

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic