WordPress.org

Ready to get started?Download WordPress

Forums

Category Icons
Please modify your plugin for wpdb prepare (5 posts)

  1. dreamsoft
    Member
    Posted 8 months ago #

    the site is showing an error
    Warning: Missing argument 2 for wpdb:repare(), called in /home/example/public_html/wp-content/plugins/category-icons/category_icons.php

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

    $wpdb->query($wpdb->prepare("CREATE TABLE IF NOT EXISTS $wpdb->ig_caticons (cat_id INT NOT NULL ,priority INT NOT NULL ,icon TEXT NOT NULL ,small_icon TEXT NOT NULL , PRIMARY KEY ( cat_id ))"));

    (the above code should be modified)

    thank you

    http://wordpress.org/plugins/category-icons/

  2. Yush
    Member
    Posted 8 months ago #

    I'm having the same problem. The error details are:

    Warning: Missing argument 2 for wpdb::prepare(), called in http://www.yourdomain.com/wp-content/plugins/category-icons/category_icons.php on line 1047 and defined in http://www.yourdomain.com/wp-includes/wp-db.php on line 992

    Lines 1045 to 1047 read
    function ig_caticons_install() {
    global $wpdb, $table_prefix;
    $wpdb->query($wpdb->prepare("CREATE TABLE IF NOT EXISTS $wpdb->ig_caticons (cat_id INT NOT NULL ,priority INT NOT NULL ,icon TEXT NOT NULL ,small_icon TEXT NOT NULL , PRIMARY KEY ( cat_id ))"));

    Line 992 to 994 read
    function prepare( $query, $args ) {

    if ( is_null( $query ) )

    return;

  3. Khazd0rf
    Member
    Posted 8 months ago #

    Same problem for me...

  4. gaolga
    Member
    Posted 8 months ago #

    Hello,

    I removed the prepare and it works fine, in the line 1047 I changed from this:

    $wpdb->query($wpdb->prepare("CREATE TABLE IF NOT EXISTS $wpdb->ig_caticons (cat_id INT NOT NULL ,priority INT NOT NULL ,icon TEXT NOT NULL ,small_icon TEXT NOT NULL , PRIMARY KEY ( cat_id ))"));

    To this:

    $wpdb->query("CREATE TABLE IF NOT EXISTS $wpdb->ig_caticons (cat_id INT NOT NULL ,priority INT NOT NULL ,icon TEXT NOT NULL ,small_icon TEXT NOT NULL , PRIMARY KEY ( cat_id ))");

    After doing that I got an error in the line 1338. So I changed from this:

    $datas = $wpdb->get_results($wpdb->prepare("SELECT cat_id, priority, icon, small_icon FROM $wpdb->ig_caticons"));

    To this:

    $datas = $wpdb->get_results("SELECT cat_id, priority, icon, small_icon FROM $wpdb->ig_caticons");

    As in those cases the prepare seems not to be needed.

    Regards...

  5. Khazd0rf
    Member
    Posted 8 months ago #

    Hi,

    Doesn't work for me, it prevents from loading wp-admin when I do this.

Reply

You must log in to post.

About this Plugin

About this Topic