I’m trying connect a remote DB to my WordPress site. This is my code for connection:
try {
$db = new wpdb($crm_db_username, $crm_db_password, $crm_db_name, $crm_db_host);
if ($db->error) throw new Exception('Error: no se ha podido realizar la conexión');
$this->crm = $db;
$this->connection_status = true;
} catch (Exception $e) {
new InmotechNotices($e->getMessage(), 'error');
$db->close();
}
The problem, according to me, is the host I’m targeting. The other database is in the same cpanel. That is, I have my WordPress database and the other database in the same Cpanel.
When I use “localhost”, it doesn’t bring me the information and when I use “localhost:port” it doesn’t work either.
In phpMyAdmin, the tree looks like:
How do I get the URI to connect to “crm api tests” or do I need to contact to support this?
If the connection is good, the data is synchronized and reaches the database on my WordPress site.