diff --git a/src/wp-includes/wp-db.php b/src/wp-includes/wp-db.php index c1b6f56477..4a875b563d 100644 --- a/src/wp-includes/wp-db.php +++ b/src/wp-includes/wp-db.php @@ -1668,12 +1668,12 @@ class wpdb { $return_val = $this->rows_affected; } else { $num_rows = 0; - if ( $this->use_mysqli ) { + if ( $this->use_mysqli && $this->result instanceof mysqli_result ) { while ( $row = @mysqli_fetch_object( $this->result ) ) { $this->last_result[$num_rows] = $row; $num_rows++; } - } else { + } else if ( is_resource( $this->result ) ) { while ( $row = @mysql_fetch_object( $this->result ) ) { $this->last_result[$num_rows] = $row; $num_rows++;