show_errors(); if ( defined('DB_CHARSET') ) $this->charset = DB_CHARSET; if ( defined('DB_COLLATE') ) $this->collate = DB_COLLATE; $this->dbh = @mysqli_connect($dbhost, $dbuser, $dbpassword); if (!$this->dbh) { $this->bail(sprintf(/*WP_I18N_DB_CONN_ERROR*/"
This either means that the username and password information in your wp-config.php file is incorrect or we can't contact the database server at %s. This could mean your host's database server is down.
If you're unsure what these terms mean you should probably contact your host. If you still need help you can always visit the WordPress Support Forums.
"/*/WP_I18N_DB_CONN_ERROR*/, $dbhost)); return; } $this->ready = true; if ( $this->has_cap( 'collation' ) ) { if ( !empty($this->charset) ) { if ( function_exists('mysqli_set_charset') ) { mysqli_set_charset($this->dbh, $this->charset); $this->real_escape = true; } else { $collation_query = "SET NAMES '{$this->charset}'"; if ( !empty($this->collate) ) $collation_query .= " COLLATE '{$this->collate}'"; $this->query($collation_query); } } } $this->select($dbname); } /** * Selects a database using the current database connection. * * The database name will be changed based on the current database * connection. On failure, the execution will bail and display an DB error. * * @since 0.71 * * @param string $db MySQL database name * @return null Always null. */ function select($db) { if (!@mysqli_select_db($this->dbh, $db)) { $this->ready = false; $this->bail(sprintf(/*WP_I18N_DB_SELECT_DB*/'We were able to connect to the database server (which means your username and password is okay) but not able to select the %1$s database.
%2$s have permission to use the %1$s database?username_%1$s. Could that be the problem?If you don\'t know how to setup a database you should contact your host. If all else fails you may find help at the WordPress Support Forums.
'/*/WP_I18N_DB_SELECT_DB*/, $db, DB_USER)); return; } } function _real_escape($string) { if ( $this->dbh && $this->real_escape ) return mysqli_real_escape_string( $this->dbh, $string ); else return addslashes( $string ); } /** * Print SQL/DB error. * * @since 0.71 * @global array $EZSQL_ERROR Stores error information of query and error string * * @param string $str The error to display * @return bool False if the showing of errors is disabled. */ function print_error($str = '') { global $EZSQL_ERROR; if (!$str) $str = mysqli_error($this->dbh); $EZSQL_ERROR[] = array ('query' => $this->last_query, 'error_str' => $str); if ( $this->suppress_errors ) return false; if ( $caller = $this->get_caller() ) $error_str = sprintf(/*WP_I18N_DB_QUERY_ERROR_FULL*/'WordPress database error %1$s for query %2$s made by %3$s'/*/WP_I18N_DB_QUERY_ERROR_FULL*/, $str, $this->last_query, $caller); else $error_str = sprintf(/*WP_I18N_DB_QUERY_ERROR*/'WordPress database error %1$s for query %2$s'/*/WP_I18N_DB_QUERY_ERROR*/, $str, $this->last_query); $log_error = true; if ( ! function_exists('error_log') ) $log_error = false; $log_file = @ini_get('error_log'); if ( !empty($log_file) && ('syslog' != $log_file) && !@is_writable($log_file) ) $log_error = false; if ( $log_error ) @error_log($error_str, 0); // Is error output turned on or not.. if ( !$this->show_errors ) return false; $str = htmlspecialchars($str, ENT_QUOTES); $query = htmlspecialchars($this->last_query, ENT_QUOTES); // If there is an error then take note of it print "WordPress database error: [$str]
$query