WordPress.org

Ready to get started?Download WordPress

Forums

Missing argument 2 for wpdb::prepare() (3 posts)

  1. mikkai
    Member
    Posted 1 year ago #

    Hi there,

    Since I upgraded to 3.5 I am getting this error: Missing argument 2 for wpdb::prepare()

    and I think this line that is the culprit but I cannot find anyone else that has this exact issue in this forum:

    <strong>$th_vers = $wpdb->get_var( $wpdb->prepare( "SELECT th_vers FROM $table WHERE id = 1 LIMIT 0,1" ) );</strong>

    Because I this error I now cannot edit information to exiting items on my website. Not a plugin issue, already tested the plugins.

    Any help with fixing the code would be greatly appreciated as my developer no longer supports my theme does not offer email support.

    Thank you!

  2. jibbius
    Member
    Posted 1 year ago #

  3. jibbius
    Member
    Posted 1 year ago #

    In this example, there are no variables which need to be sanitised,
    Fix is to do this:

    prepare( "SELECT th_vers FROM $table WHERE id = 1 LIMIT 0,1" , "")

    I've added ,"" before closing the prepare() function.

Topic Closed

This topic has been closed to new replies.

About this Topic