WordPress.org

Support

Support » Plugins and Hacks » Banner Garden Plugin for WordPress » Warning: Missing argument 2 for wpdb::prepare()

Warning: Missing argument 2 for wpdb::prepare()

  • I’m aware Banner Garden has been inactive for quite sometime, but hadn’t noticed if there was an issue with it (I don’t think so) until the 3.6 update. I’m having this issue with this warning.

    Any kind soul wants to jumpstart this plugin? It’s really the simplest random plugin out there.

    Warning: Missing argument 2 for wpdb::prepare(), ****/banner-garden/bannergarden.class.php on line 404 and defined in *wp-includes/wp-db.php on line 992

    $count_of_banners = $wpdb->get_var($wpdb->prepare("SELECT count(*) FROM ".$this->b_table." WHERE b_campaign = ".$camp->c_id));

    Warning: Missing argument 2 for wpdb::prepare(), called in /***/banner-garden/bannergarden.class.php on line 383 and defined in /***/wp-includes/wp-db.php on line 992

    $name = $wpdb->get_var($wpdb->prepare("SELECT c_name FROM ".$this->c_table." WHERE c_id = ".$c_id));

    Warning: Missing argument 2 for wpdb::prepare(), called in /***/banner-garden/bannergarden_frontend.class.php on line 141 and defined in /***/wp-includes/wp-db.php on line 992

    $count = $wpdb->get_var($wpdb->prepare("SELECT count(*) FROM ".$this->c_table." WHERE c_id = ".$c_id));

    I added “, $id, $name” (can you tell I’m null at this?) as this pointed, and it got rid of the warnings but the plugin isn’t letting me add new banners or modify them.

    http://wordpress.org/plugins/banner-garden/

Viewing 2 replies - 1 through 2 (of 2 total)
  • Hi there!

    I resolved, change this lines.

    in bannergarden.class.php

    383- $name = $wpdb->get_var($wpdb->prepare(“SELECT c_name FROM “.$this->c_table.” WHERE c_id = %d”,$c_id));

    404 – $count_of_banners = $wpdb->get_var($wpdb->prepare(“SELECT count(*) FROM “.$this->b_table.” WHERE b_campaign = %d”, $camp->c_id));

    and in bannergarden_frontend.class.php

    141- $count = $wpdb->get_var($wpdb->prepare(“SELECT count(*) FROM “.$this->c_table.” WHERE c_id = %d”,$c_id));

    in the folder js I change bannergarden_banners.js.php

    /**************************************/
    /********* AJAX FORM CONTROL **********/
    /**************************************/

    39 $(‘#code, #flash, #pic’).bind(‘click’, function()
    to
    39 jQuery(‘#code, #flash, #pic’).bind(‘click’, function()

    and works then.

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