WordPress.org

Ready to get started?Download WordPress

Forums

Resume Submissions & Job Postings
[resolved] Warning: Missing argument 2 for wpdb::prepare() (9 posts)

  1. Emil Uzelac
    Theme Review Admin
    Posted 1 year ago #

    FYI:

    wpdb::prepare()now requires at least 2 arguments. Please see the Changeset 22429 :)

    This is to avoid:

    Warning: Missing argument 2 for wpdb::prepare(), called in /wp-content/plugins/resume-submissions-job-postings/includes/form.php on line 341 and defined in wp-includes/wp-db.php on line 990

    Great plugin BTW :)

    P.S. Also see this post please.

    Thanks,
    Emil

    http://wordpress.org/extend/plugins/resume-submissions-job-postings/

  2. kandrews
    Member
    Plugin Author

    Posted 1 year ago #

    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.

  3. warrior300
    Member
    Posted 1 year ago #

    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 ]

  4. 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.

  5. Emil Uzelac
    Theme Review Admin
    Posted 1 year ago #

    @kandrews Thanks was long overdue :)

  6. 99fusion
    Member
    Posted 1 year ago #

    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 !

  7. Emil Uzelac
    Theme Review Admin
    Posted 1 year ago #

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

    Emil

  8. grizly707
    Member
    Posted 1 year ago #


  9. Mihaly Soft
    Member
    Posted 1 year ago #

    $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));

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.