Support » Installing WordPress » Warning: Missing argument 2 for wpdb::prepare()

  • Hii !

    I am getting this error after updating my wordpress to 3.5 !

    Warning: Missing argument 2 for wpdb::prepare(), called in /home/XXX/domains/XXX/public_html/wp-content/plugins/ucan-post/ucan-post-class.php on line 360 and defined in /home/XXX/domains/XXX/public_html/wp-includes/wp-db.php on line 990

    this is line 360 of ucan-post-class.php file :

    $wpdb->query($wpdb->prepare(“INSERT INTO {$this->ucan_db_submissions} (type,name,email,postid) VALUES (‘{$type}’, ‘{$name}’, ‘{$email}’, ‘{$postid}’)”));

    can anyone help me ?!

Viewing 5 replies - 1 through 5 (of 5 total)
  • read http://wordpress.org/support/topic/troubleshooting-wordpress-35-master-list?replies=4

    related to the ‘ucan-post’ plugin (does not seem to be from the WordPress plugins directory);

    possibly try to inform the plugin’s developer about the issue

    Thread Starter isMail ElFa

    (@ismail-elfa)

    I have checked this thread about the problem:
    http://make.wordpress.org/core/2012/12/12/php-warning-missing-argument-2-for-wpdb-prepare

    but i don’t get nothing there ! What should i change ?!

    $wpdb->query($wpdb->prepare(“INSERT INTO {$this->ucan_db_submissions} (type,name,email,postid) VALUES (‘{$type}’, ‘{$name}’, ‘{$email}’, ‘{$postid}’)”));

    please, can anyone help me !!

    Its the first time I do it this way and I see how its more secure, so hopefully its not wrong. If it’s let me know.
    For your example:

    $wpdb->query($wpdb->prepare(“INSERT INTO {$this->ucan_db_submissions} (type,name,email,postid) VALUES (‘{$type}’, ‘{$name}’, ‘{$email}’, ‘{$postid}’)”));

    would become something like…

    $wpdb->query( $wpdb->prepare(“INSERT INTO {$this->ucan_db_submissions} (type,name,email,postid) VALUES (‘{%d}’, ‘{%s}’, ‘{%d}’, ‘{%s}’)”, $type, $name, $email, $postid ) );

    Im still not sure how they handle more than 2 variables but I tried %d & %s as needed so twice. I hope this helps.

    Thread Starter isMail ElFa

    (@ismail-elfa)

    none, not working !!

    another error on line 367 :

    return $wpdb->get_results($wpdb->prepare(“SELECT * FROM {$this->ucan_db_submissions} ORDER BY id DESC”));
    }

    what to do ?!
    thanks andresgh !

    That’s an error from the plugin.
    If you give me the entire error I might be able to come up with some solution.

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