WordPress.org

Ready to get started?Download WordPress

Forums

Download Monitor
Missing argument 2 for wpdb::prepare() (9 posts)

  1. lelebart
    Member
    Posted 1 year ago #

    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/

  2. ygirod
    Member
    Posted 1 year ago #

    Unfortunately, it doesn't solve for me. Any other idea ?

  3. WP_Newbe
    Member
    Posted 1 year ago #

    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

  4. hjgode
    Member
    Posted 1 year ago #

    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

  5. WP_Newbe
    Member
    Posted 1 year ago #

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

  6. lelebart
    Member
    Posted 1 year ago #

    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.)

  7. Slysoft
    Member
    Posted 11 months ago #

    A similar problem here after WP 3.6.1 update.

    How can I fix that?

  8. mikejolley
    Member
    Plugin Author

    Posted 11 months ago #

    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.

  9. mikejolley
    Member
    Plugin Author

    Posted 11 months ago #

    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.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic