• Hello!

    I’ve updated my wp and I’ve got 2 errors:

    Missing argument 2 for wpdb::prepare() in /home/…./public_html/wp-content/themes/piano black/sidebar.php on line 75 and defined in /home/…/public_html/wp-includes/wp-db.php on line 992

    line 75 of siderbar.php:

    $post_datetimes = $wpdb->get_row($wpdb->prepare(“SELECT YEAR(min(post_date_gmt)) AS firstyear, YEAR(max(post_date_gmt)) AS lastyear FROM $wpdb->posts WHERE post_date_gmt > 2000”));

    and line 992 of wp-db.php:
    function prepare( $query, $args ) {

    I’ve read on the forum and I think I should add a new argument to WHERE post_date_gmt > 2000 but I haven’t foumd arguments for date expression.

    Could somebody help me?

    Thanks

Viewing 6 replies - 1 through 6 (of 6 total)
  • Moderator t-p

    (@t-p)

    Thread Starter Robertooo

    (@robertooo)

    Thanks. I’ve already read that but I don’t know what is the ID at the date .

    I can’t find examples for the date.

    i have facing error in my theme can anyone solve this issue

    WARNING: MISSING ARGUMENT 2 FOR WPDB::PREPARE(), CALLED IN C:\WAMP\WWW\WP-CONTENT\THEMES\ENVISION THEME\ENVISION\LIBRARY\TFUSE_FRAMEWORK\FUNCTIONS\CORE.PHP ON LINE 21 AND DEFINED IN C:\WAMP\WWW\WP-INCLUDES\WP-DB.PHP ON LINE 992

    ——————

    core.php line 21

    return $wpdb->get_var($wpdb->prepare(“SELECT COUNT(meta_key) FROM $wpdb->postmeta WHERE meta_key = ‘$meta’ AND post_id = $post_id;”));

    wp-db.php line 992

    function prepare( $query, $args ) {
    if ( is_null( $query ) )
    return;

    $args = func_get_args();
    array_shift( $args );
    // If args were passed as an array (as in vsprintf), move them up
    if ( isset( $args[0] ) && is_array($args[0]) )
    $args = $args[0];
    $query = str_replace( “‘%s'”, ‘%s’, $query ); // in case someone mistakenly already singlequoted it
    $query = str_replace( ‘”%s”‘, ‘%s’, $query ); // doublequote unquoting
    $query = preg_replace( ‘|(?<!%)%f|’ , ‘%F’, $query ); // Force floats to be locale unaware
    $query = preg_replace( ‘|(?<!%)%s|’, “‘%s'”, $query ); // quote the strings, avoiding escaped strings like %%s
    array_walk( $args, array( $this, ‘escape_by_ref’ ) );
    return @vsprintf( $query, $args );
    }

    ————–

    please solve this issue i am trying but failed so, help me out

    @jacksii – please contact the developers of your theme for help with this issue – these forums only support themes from the repository on this site.

    Also, next time, please start your own thread and do not post the same question more than once – see:

    https://codex.www.ads-software.com/Forum_Welcome#Where_To_Post

    (Your duplicate posts in other outdated threads have been deleted.)

    @wpyogi, dont worry i have fix this issue on my self thanks for response me

    Moderator t-p

    (@t-p)

    @jacksii:

    Do you care to share for the benefit of others who might stumble upon this thread.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘WP update to 3.6 – Missing argument 2 for wpdb::prepare()’ is closed to new replies.