WordPress.org

Support

Support » Plugins and Hacks » Produces WP DB Error

Produces WP DB Error

  • Download.php produces this error:

    Warning: Missing argument 2 for wpdb::prepare(), called in /wp-content/plugins/download-monitor/download.php on line 208

    This is because $wpdb->prepare is not formatted properly. Line 208 shows:

    $old_date = $wpdb->get_var( $wpdb->prepare( “SELECT date FROM $wp_dlm_db_log WHERE ip_address = ‘$ipAddress’ AND download_id = “.$d->id.” ORDER BY date DESC limit 1;”) );

    It should be:

    $old_date = $wpdb->get_var( $wpdb->prepare( “SELECT date FROM $wp_dlm_db_log WHERE ip_address = %d AND download_id = %s ORDER BY date DESC limit 1;”, $ipAddress, $d->id) );

    I fixed it on my site and it works fine once the proper syntax is used.

    More information about this can be found here:

    PHP Warning: Missing argument 2 for wpdb::prepare()

    http://wordpress.org/extend/plugins/download-monitor/

  • The topic ‘Produces WP DB Error’ is closed to new replies.