Support » Plugin: Resume Submissions & Job Postings » Warning: Missing argument 2 for wpdb::prepare()

Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Author kandrews

    (@kandrews)

    Yeah I’ve noticed this now.

    The quick fix would be to add , null inside the prepare() after the query in the pages form.php and submissions.php.

    Think I will send out an update for this today.

    plz help me i cnt undrstnd anythng here so u repair my website plz plz plz mail me [ redacted, support is offered via the forum and not email ]

    Moderator Jan Dembowski

    (@jdembowski)

    Brute Squad and Volunteer Moderator

    Please start your own topic (if this is the plugin you need support with):

    http://wordpress.org/support/plugin/resume-submissions-job-postings#postform

    And please do not post your email address like that. Support is not offered via email, Skype, or instant messenger. If you need professional support then consider posting a request to http://jobs.wordpress.net/ instead.

    Emil Uzelac

    (@emiluzelac)

    Theme Review Admin

    @kandrews Thanks was long overdue 🙂

    Strangely that doesn’t work ….

    This function works fine with the wpdb missing argument 2 error but displays the result.
    function get_image_id($image_url) {
    global $wpdb;
    $prefix = $wpdb->prefix;
    $attachment = $wpdb->get_col($wpdb->prepare(“SELECT ID FROM ” . $prefix . “posts” . ” WHERE guid='” . $image_url . “‘;”,”));
    if($attachment)
    return $attachment[0];
    else
    return false;
    }

    Whereare below function with the “recommended” code returns false everytime.
    function get_image_id($image_url) {
    global $wpdb;
    $posttable = $wpdb->prefix.’posts’;
    $attachment = $wpdb->get_col($wpdb->prepare(“SELECT ID FROM %d WHERE guid= %s”,$posttable,$image_url));
    if($attachment)
    return $attachment[0];
    else
    return false;
    }

    Any help would be useful !

    Emil Uzelac

    (@emiluzelac)

    Theme Review Admin

    Definitely weird, I am looking at my clients site now and it seems to be working just fine 🙂

    Emil

    $attachment = $wpdb->get_col($wpdb->prepare(“SELECT ID FROM %d WHERE guid= %s”,$posttable,$image_url));

    Both arguments are strings, but you added “%d” for the first one. 🙂
    Correct:
    $attachment = $wpdb->get_col($wpdb->prepare(“SELECT ID FROM %s WHERE guid= %s“,$posttable,$image_url));

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