diff --git a/wp-includes/wp-db.php b/wp-includes/wp-db.php index a57764b422..335fd01eec 100644 --- a/wp-includes/wp-db.php +++ b/wp-includes/wp-db.php @@ -21,6 +21,7 @@ class wpdb { var $col_info; var $queries; var $prefix = ''; + var $ready = false; // Our tables var $posts; @@ -72,12 +73,14 @@ class wpdb {

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.

"); + return; } if ( !empty($this->charset) && version_compare(mysql_get_server_info(), '4.1.0', '>=') ) $this->query("SET NAMES '$this->charset'"); $this->select($dbname); + $this->ready = true; } function __destruct() { @@ -119,6 +122,7 @@ class wpdb {
  • On some systems the name of your database is prefixed with your username, so it would be like username_wordpress. 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.

    "); + return; } } @@ -218,6 +222,9 @@ class wpdb { // Basic Query - see docs for more detail function query($query) { + if ( ! $ready ) + return false; + // filter the query, if filters are available // NOTE: some queries are made before the plugins have been loaded, and thus cannot be filtered with this method if ( function_exists('apply_filters') )