WordPress.org

Ready to get started?Download WordPress

Forums

NextGEN Gallery
[resolved] Warning: Missing argument 2 for wpdb::prepare( (12 posts)

  1. kpelham
    Member
    Posted 1 year ago #

    Just updated my site and get this error.

    How do I fix? I have a gallery w/ this plugin

    Warning: Missing argument 2 for wpdb::prepare(), called in /home/mysite/public_html/blog/wp-content/plugins/nextgen-gallery/lib/tags.php on line 318 and defined in /home/mysite/public_html/blog/wp-includes/wp-db.php on line 990

    http://wordpress.org/extend/plugins/nextgen-gallery/

  2. secretgardens
    Member
    Posted 1 year ago #

    I have the same issue on my site, can someone help me fix this?

    Warning: Missing argument 2 for wpdb::prepare(), called in /home/secretga/public_html/wp-content/plugins/nextgen-gallery/lib/tags.php on line 318 and defined in /home/secretga/public_html/wp-includes/wp-db.php on line 990

  3. Tito Alarcón
    Member
    Posted 1 year ago #

    I have the same issue on my site, can someone help me fix this?
    and on the page that I put an album, you can see the thumbnails to enter galleries but they do not look the photos
    http://identidadyfuturo.cl/galerias/

    Warning: Missing argument 2 for wpdb::prepare(), called in /home/content/30/7871430/html/wp-content/plugins/nextgen-gallery/lib/tags.php on line 318 and defined in /home/content/30/7871430/html/wp-includes/wp-db.php on line 990

  4. gala1929
    Member
    Posted 1 year ago #

    I also have this problem when i upload wysija newsletter plugin

  5. jsit
    Member
    Posted 1 year ago #

    You make this:

    open nextgen-gallery/lib/tags.php AND edit: add , 'ngg_tag'

    // first get all $term_ids with this tag
    $term_ids = $wpdb->get_col( $wpdb->prepare("SELECT term_id FROM $wpdb->terms WHERE slug IN ($sluglist) ORDER BY term_id ASC ", 'ngg_tag'));

    Now run by me ;)

  6. jsit
    Member
    Posted 1 year ago #

    This is the Function in wpdp.php

    /**
    	 * Prepares a SQL query for safe execution. Uses sprintf()-like syntax.
    	 *
    	 * The following directives can be used in the query format string:
    	 *   %d (integer)
    	 *   %f (float)
    	 *   %s (string)
    	 *   %% (literal percentage sign - no argument needed)
    	 *
    	 * All of %d, %f, and %s are to be left unquoted in the query string and they need an argument passed for them.
    	 * Literals (%) as parts of the query must be properly written as %%.
    	 *
    	 * This function only supports a small subset of the sprintf syntax; it only supports %d (integer), %f (float), and %s (string).
    	 * Does not support sign, padding, alignment, width or precision specifiers.
    	 * Does not support argument numbering/swapping.
    	 *
    	 * May be called like {@link http://php.net/sprintf sprintf()} or like {@link http://php.net/vsprintf vsprintf()}.
    	 *
    	 * Both %d and %s should be left unquoted in the query string.
    	 *
    	 * <code>
    	 * wpdb::prepare( "SELECT * FROM <code>table</code> WHERE <code>column</code> = %s AND <code>field</code> = %d", 'foo', 1337 )
    	 * wpdb::prepare( "SELECT DATE_FORMAT(<code>field</code>, '%%c') FROM <code>table</code> WHERE <code>column</code> = %s", 'foo' );
    	 * </code>
    	 *
    	 * @link http://php.net/sprintf Description of syntax.
    	 * @since 2.3.0
    	 *
    	 * @param string $query Query statement with sprintf()-like placeholders
    	 * @param array|mixed $args The array of variables to substitute into the query's placeholders if being called like
    	 * 	{@link http://php.net/vsprintf vsprintf()}, or the first variable to substitute into the query's placeholders if
    	 * 	being called like {@link http://php.net/sprintf sprintf()}.
    	 * @param mixed $args,... further variables to substitute into the query's placeholders if being called like
    	 * 	{@link http://php.net/sprintf sprintf()}.
    	 * @return null|false|string Sanitized query string, null if there is no query, false if there is an error and string
    	 * 	if there was something to prepare
    	 */
    	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 );
    	}
    
    	/**
  7. esmi
    Forum Moderator
    Posted 1 year ago #

    You will need to wait until the plugin is updated. Do NOT touch wpdb.php!

    http://wordpress.org/support/topic/troubleshooting-wordpress-35-master-list

  8. jsit
    Member
    Posted 1 year ago #

    I dont touch wpdb.php, i have edit the "nextgen-gallery/lib/tags.php" File !! This is the PlugIn File.

    sry for bad engl.

  9. TasiaChiba
    Member
    Posted 1 year ago #

    jsit's fix worked perfectly for me. Thank you very much!!!! Now for NextGen to get it fixed and updated.

  10. esmi
    Forum Moderator
    Posted 1 year ago #

    @jsit: Sorry! My bad!

  11. Robertooo
    Member
    Posted 1 year ago #

    I have the same error, and this is my 990th row:

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

    How could I fix it?

  12. photocrati
    Member
    Plugin Author

    Posted 1 year ago #

    Hey everyone,

    We've already discussed this error in this forum, you'll find a temp. solution until we release another upgrade, in this forum thread: http://wordpress.org/support/topic/missing-argument-wpdb-in-35-final?replies=37

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic