Quantcast
Channel: Topic Tag: MySQL | WordPress.org
Viewing all articles
Browse latest Browse all 5530

Chris_topher on "need to find an external database's prefix"

$
0
0

I'm creating a plugin and part of the plugin requires that I connect to an external WordPress site and use that site's external database to get some information. I have established a connection and I have accessed the external database's $wpdb using the code below:

global $new_wpdb;

define( 'BLOCK_LOAD', true );
require_once( $_SERVER['DOCUMENT_ROOT'] . '/wp-config.php' );
require_once( $_SERVER['DOCUMENT_ROOT'] . '/wp-includes/wp-db.php' );
$new_wpdb = new wpdb( $username, $password, $dbname, $servername);
$new_wpdb->show_errors();

When I use print_r($new_wpdb);, I get the array and I can see the values for the external database's username, password, etc. However, there's no value for prefix or base_prefix. It's just displaying the following for the prefix:

[prefix] => [base_prefix] =>
How do I get the prefix that the external database is using?


Viewing all articles
Browse latest Browse all 5530

Trending Articles