Title: Produces WP DB Error
Last modified: August 20, 2016

---

# Produces WP DB Error

 *  [ELsMystERy](https://wordpress.org/support/users/elsmystery/)
 * (@elsmystery)
 * [13 years, 5 months ago](https://wordpress.org/support/topic/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()](https://make.wordpress.org/core/2012/12/12/php-warning-missing-argument-2-for-wpdb-prepare/)
 * [http://wordpress.org/extend/plugins/download-monitor/](http://wordpress.org/extend/plugins/download-monitor/)

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

 * ![](https://ps.w.org/download-monitor/assets/icon-256x256.png?rev=3198936)
 * [Download Monitor](https://wordpress.org/plugins/download-monitor/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/download-monitor/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/download-monitor/)
 * [Active Topics](https://wordpress.org/support/plugin/download-monitor/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/download-monitor/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/download-monitor/reviews/)

 * 0 replies
 * 1 participant
 * Last reply from: [ELsMystERy](https://wordpress.org/support/users/elsmystery/)
 * Last activity: [13 years, 5 months ago](https://wordpress.org/support/topic/produces-wp-db-error/)
 * Status: not resolved