WordPress.org

Support

Support » Plugins and Hacks » Simple Ads Manager » "Missing argument 2 for wpdb::prepare()" after wordpress update

"Missing argument 2 for wpdb::prepare()" after wordpress update

  • After updating to WordPress 3.5 I get the following errors:-

    Warning: Missing argument 2 for wpdb::prepare() called in /wp-content/plugins/simple-ads-manager/list.admin.class.php on line 118 and defined in /wp-includes/wp-db.php on line 990

    Warning: Missing argument 2 for wpdb::prepare(), called in /wp-content/plugins/simple-ads-manager/list.admin.class.php on line 119 and defined in /wp-includes/wp-db.php on line 990

    This occurs with both 1.7.57 and previous version.

    http://wordpress.org/extend/plugins/simple-ads-manager/

Viewing 6 replies - 1 through 6 (of 6 total)
  • The same thing happened with me, and after changing some codes in some php files the problem seems to be fixed. I hope that a new version of the plugin will be available so we can just update it and all files will be fixed at once.

    Despite the error, looks like the plugin works normally.

    i got the same warning msg on mysite.com/wp-admin/admin.php?page=sam-list

    Hi,

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

    and then change in
    /wordpress/wp-content/plugins/simple-ads-manager/list.admin.class.php

    lines 118 and 119 to

    $trash_num = $wpdb->get_var($wpdb->prepare(‘SELECT COUNT(*) FROM ‘.$pTable.’ WHERE trash = %s’, TRUE));
    $active_num = $wpdb->get_var($wpdb->prepare(‘SELECT COUNT(*) FROM ‘.$pTable.’ WHERE trash = %s’, FALSE));

    on line 118 & 119 is
    $all_num = $trash_num + $active_num;
    $total = (($mode !== ‘all’) ? (($mode === ‘trash’) ? $trash_num : $active_num) : $all_num);
    right?

    … no, sorry, not in my case.

    Search for
    $trash_num = $wpdb->get_var($wpdb->prepare(‘SELECT COUNT(*) FROM ‘.$pTable.’ WHERE trash = TRUE));
    and
    $active_num = $wpdb->get_var($wpdb->prepare(‘SELECT COUNT(*) FROM ‘.$pTable.’ WHERE trash = FALSE));

    Should be 3 lines or so above …

    This does not completely fix the problem.
    If you click on the settings tab, you still get errors about unknown variables of instance.
    But thanks anyway for this tip.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘"Missing argument 2 for wpdb::prepare()" after wordpress update’ is closed to new replies.
Skip to toolbar