WordPress.org

Ready to get started?Download WordPress

Forums

Download Monitor
Produces WP DB Error (1 post)

  1. ELsMystERy
    Member
    Posted 1 year ago #

    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:

    http://make.wordpress.org/core/2012/12/12/php-warning-missing-argument-2-for-wpdb-prepare/

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

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.