WordPress.org

Support

Support » Plugins and Hacks » [Resolved] Warning: Missing argument 2 for wpdb::prepare()

[Resolved] Warning: Missing argument 2 for wpdb::prepare()

Viewing 6 replies - 1 through 6 (of 6 total)
  • I did the wp-config.php edit. So now I do not have any sql vurnability anymore?

    It is only a warning, no reason to panic. With that said I understand your frustration, like you i don’t like notices or warnings. I like everything to perform “issue” free.

    The issue here is as simple as an argument not being set for the prepare function. As of wordpress 3.5 wpdb::prepare() enforces a minimum of two arguments. you can read more here:

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

    to fix this simple make this change:

    In /plugins/cimy-user-extra-fields/cimy_uef_profile.php
    on line 101 change

    $value = $wpdb->get_var($wpdb->prepare("SELECT VALUE FROM ".$wpdb_data_table." WHERE USER_ID=".$get_user_id." AND FIELD_ID=".$field_id));

    to

    $value = $wpdb->get_var($wpdb->prepare("SELECT VALUE FROM ".$wpdb_data_table." WHERE USER_ID=".$get_user_id." AND FIELD_ID=".$field_id,0));

    and line 105

    $radio_checked[$name] = $wpdb->get_var($wpdb->prepare("SELECT COUNT(*) FROM ".$wpdb_data_table." WHERE USER_ID=".$get_user_id." AND FIELD_ID=".$field_id." AND VALUE=\"selected\""));

    to

    $radio_checked[$name] = $wpdb->get_var($wpdb->prepare("SELECT COUNT(*) FROM ".$wpdb_data_table." WHERE USER_ID=".$get_user_id." AND FIELD_ID=".$field_id." AND VALUE=\"selected\"",0));

    Thank you very much. Solved.

    Please help me .. its really urgent got an error

    Warning: Missing argument 2 for wpdb::prepare(), called in /home/wikips9x/public_html/hotelinternational.in/wp-content/themes/welcome_inn/library/tfuse_framework/functions/core.php on line 21 and defined in /home/wikips9x/public_html/hotelinternational.in/wp-includes/wp-db.php on line 992

    Plugin Author Marco Cimmino

    @cimmo

    @abhijotesingh
    This is a topic regarding Cimy User Extra Fields plug-in, you are talking about problems on ‘welcome_inn’ theme which is totally off topic here.
    Open a new thread please!

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