WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] [closed] Missing argument 2 for wpdb::prepare(), (20 posts)

  1. THEGrizz
    Member
    Posted 1 year ago #

    I upgraded to from 3.4.2 to 3.5 yesterday and now I'm getting these errors when new members register for my site :( Anyone willing to help???

    Warning: Missing argument 2 for wpdb::prepare(), called in /home/content/03/10010703/html/pcvdo/wp-content/plugins/membership/membershipincludes/classes/membershipadmin.php on line 4898 and defined in /home/content/03/10010703/html/pcvdo/wp-includes/wp-db.php on line 990

    Warning: Missing argument 2 for wpdb::prepare(), called in /home/content/03/10010703/html/pcvdo/wp-content/plugins/membership/membershipincludes/classes/membershipadmin.php on line 4904 and defined in /home/content/03/10010703/html/pcvdo/wp-includes/wp-db.php on line 990

    Warning: Missing argument 2 for wpdb::prepare(), called in /home/content/03/10010703/html/pcvdo/wp-content/plugins/membership/membershipincludes/classes/membershipadmin.php on line 4855 and defined in /home/content/03/10010703/html/pcvdo/wp-includes/wp-db.php on line 990

    Warning: Missing argument 2 for wpdb::prepare(), called in /home/content/03/10010703/html/pcvdo/wp-content/plugins/membership/membershipincludes/classes/membershipadmin.php on line 4791 and defined in /home/content/03/10010703/html/pcvdo/wp-includes/wp-db.php on line 990

  2. Your site is fine, but you may wish to turn off PHP's display errors setting. Contact your theme or plugin dev and point them to http://make.wordpress.org/core/2012/12/12/php-warning-missing-argument-2-for-wpdb-prepare/ so they can fix the underlying issue.

  3. THEGrizz
    Member
    Posted 1 year ago #

    Thank you songdogtech! The plug-in worked just fine until I upgrade to 3.5. I had a member register tonight that pointed it out to me. Thanks again!!

  4. tushar43
    Member
    Posted 1 year ago #

    Hi,

    I am also getting EXACTLY the same error after I upgraded to 3.5. Please help me.

  5. tushar43
    Member
    Posted 1 year ago #

    Just to update, I am seeing this error on certain themes only especially themes from one particular developer (blocks, blocks2, elegent box etc)

    If I choose some other themes, this error disappears but I somehow don't want to change the theme. Please help.

  6. tushar43
    Member
    Posted 1 year ago #

    Found the solution :-)

    The theme file (mentioned in the error) was using $wpdb->prepare in insecure manner. Changing following did the trick. The warning was earlier being issued by wordpress since it now wants developers to parse variables securely instead of directly parsing in the statement. So another argument is a must in $wpdb->prepare call in such cases.

    For example you can change
    $wpdb->prepare( "SELECT * FROM table WHERE id = $id" );
    to
    $wpdb->prepare( "SELECT * FROM table WHERE id = %d", $id );

    Cheers,
    Tushar

  7. aleksandrarocks
    Member
    Posted 1 year ago #

    Hello, I am getting the same notification on my WP dashboard when i log in. And I seems to be experiencing other difficulties as well - like can't upload photos. I am wondering if you could explain in novice-friendly terms what can I do to fix this, possibly through the WP dashboard itself rather then ftp login?

    Thank you for your help.

    Aleksa.

  8. See the link I posted above earlier and below. Your site is fine, but you may wish to turn off PHP's display errors setting. Contact your theme or plugin dev and point them to http://make.wordpress.org/core/2012/12/12/php-warning-missing-argument-2-for-wpdb-prepare/ so they can fix the underlying issue. And read http://wordpress.org/support/topic/troubleshooting-wordpress-35-master-list?replies=4

  9. nekskm
    Member
    Posted 1 year ago #

    The solution that @tushar43 posted work great!

  10. bridalbebonheur
    Member
    Posted 1 year ago #

    HELP!
    I don't understand any of the above. I can't contact my theme or plug dev because there is no one to contact. I don't even know who my plug dev is!! what do I do?

  11. alchymyth
    Forum Moderator
    Posted 1 year ago #

    @bridalbebonheur

    ideally, start your own topic;
    in any case, post more details, such as which theme you are using, and the exact warning message, and which plugins are involved....

  12. brownbear73
    Member
    Posted 1 year ago #

    Hi, I have this message
    Warning: Missing argument 2 for wpdb::prepare(), called in /home/zlcenerg/public_html/wp-content/themes/zlc/page-tertiary-a.php on line 60 and defined in /home/zlcenerg/public_html/wp-includes/wp-db.php on line 990

    I think I've found the correct line, and looking at tushar43's post, I'm wondering if it could be this bit of code -

    "SELECT * FROM $wpdb->posts WHERE guid = '$cross_a_image'"

    However, am a complete novice, and really have no idea, so just making a vaguely informed guess from searching through posts!
    Any help greatly appreciated! Thanks
    http://www.zlcenergy.co.uk/contact-us/arrange-survey/

  13. brownbear73
    Member
    Posted 1 year ago #

    oh, also, from looking at the page of code, it looks like it could be something from yoast,<?php if ( function_exists('yoast_breadcrumb') ) {
    yoast_breadcrumb('<p id="breadcrumbs">','</p>');
    } ?>

    but wouldn't have any idea about how to contact them or if it's even a plug in of theirs, I didn't originally set up the plug in...?!

  14. laconic
    Member
    Posted 1 year ago #

    See the codex for information on proper use of wpdp->prepare with php variables: http://codex.wordpress.org/Class_Reference/wpdb

  15. SEO PBS
    Member
    Posted 1 year ago #

    Easy update Post Types Order version on wordpress ==>> fix Missing argument 2 for wpdb::prepare(),

  16. mikepoynton
    Member
    Posted 1 year ago #

    @SEO PBS Can you elaborate on the "Easy update"?

  17. SEO PBS
    Member
    Posted 1 year ago #

    @mikepoynton After update wordpress to 3.5 >> error Missing argument 2 for wpdb::prepare(), ... I can not fix the code, but I updated the plugin named "Post Types Order", the error disappeared

  18. ogunkunle
    Member
    Posted 1 year ago #

    Am also experiencing the same thing when i upgrade my buddyress to 1.6.3 and install bp gifts rebirth plugin and bp chat beta 3,4,5 plugin

  19. loveiPhone
    Member
    Posted 1 year ago #

    After upgrading to WordPress 3.5, I am getting the following Warning:

    Warning: Missing argument 2 for wpdb::prepare(), called in /home/*****/public_html/wp-content/themes/******/framework/plugins/post-types-order/post-types-order.php on line 173 and defined in /home/*****/public_html/wp-includes/wp-db.php on line 990

    Line 173 has the following code:

    $where = $wpdb->prepare("WHERE p.post_date < '".$current_post_date."' AND p.post_type = '". $post->post_type ."' AND p.post_status = 'publish' AND p.ID != '". $post->ID ."' $posts_in_ex_cats_sql");

    Please help.

    Thank you

  20. WPyogi
    Volunteer Moderator
    Posted 1 year ago #

    @loveiPhone and ogunkunle anyone else who needs help - please start your own threads - this one is marked resolved (and is now closed) so it is not a good place to get help.

Topic Closed

This topic has been closed to new replies.

About this Topic