WordPress.org

Support

Support » Plugins and Hacks » Missing argument 2 for wpdb::prepare()

Missing argument 2 for wpdb::prepare()

  • hi, i’m getting this warning: Warning: Missing argument 2 for wpdb::prepare(), called in /wp-content/plugins/download-monitor/uploader.php on line 244 and defined in /wp-includes/wp-db.php on line 990

    as i read here, it’s not the proper way use prepare for such usage, but i’m so noob i don’t know how to call the query directly, as there are no inputs.

    could it be from $total_results = $wpdb->prepare( "SELECT COUNT(id) FROM $wp_dlm_db;" );

    to $total_results = $wpdb->query( "SELECT COUNT(id) FROM $wp_dlm_db;" );

    ? thanks in advance. if it does solve, hth

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

Viewing 8 replies - 1 through 8 (of 8 total)
  • Unfortunately, it doesn’t solve for me. Any other idea ?

    hi lelebart

    $total_results = $wpdb->prepare( “SELECT COUNT(‘%s’) FROM $wp_dlm_db;”, id );

    Just a little thing more, when I add a download to a post, the list to choose the output format doesn’t work, perhaps someone has an idea? but it’s just a detail.

    good luck

    Thanks a lot, @wp_newbe the chang works for me. But it woul be nice to include file name and line number the next time.

    I am still seeing problems:
    New downloads are not inserted into post when (Insert) is pressed in Download-Monitor. I had to look thru the download list and then select Insert there to get the download inserted into my post.

    regards

    Josef

    Actually, if you read carefully, the file name and line number is just in the first lelebart’s post.

    thanks @wp_newbe, dunno if you missed the quotes or bbpress removed them, here the line in use on my site

    $total_results = $wpdb->prepare( "SELECT COUNT('%s') FROM $wp_dlm_db;", "id" );

    about the insert button, i have the same issue: it doesn’t work, even with the default value. atm i switch to the other tab, search for the just-made download entry and insert from there: it does work with the format select too. (maybe a jQuery problem? new thread is coming.)

    Slysoft

    @slysoft

    A similar problem here after WP 3.6.1 update.

    How can I fix that?

    Plugin Contributor Mike Jolley

    @mikejolley

    There are two instances of incorrect $wpdb->prepare usage in the current version – this will be fixed in the next minor release.

    Turn off WP_DEBUG/error reporting if you have a production site.

    Plugin Contributor Mike Jolley

    @mikejolley

    Actually scrub that, there are no issues in 1.1.2. If you are using legacy, you’ll need to search the source for the $wpdb->prepare statements which have no arguments and fix them manually.

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Missing argument 2 for wpdb::prepare()’ is closed to new replies.