Hi i am trying to access remote database using PHP. remote database is MySQL. Below is the screen shot of the error i am getting.can any one help me.Thanks in advance.
following are perfectly alright i have checked:-
- Database name
- port number
- IP address
- username and password
here is the database connectivity code
<?php
class Database {
/*
public $dbhost = "mysql:dbname=a_t;host=localhost:3306";
$dbhost = "mysql:host=10.75.225.171;port=3306;dbname=apt";
public $dbuser = "root";
public $dbpass = "root";
public $dbname = "a_t";
public $connection;
public $selectdb;
public $isConnected;
public $dbh;
*/
public $dbhost = "mysql:dbname=25thcraft;host=52.xx.xx.xxx;port=3306";
public $dbuser = "tribhuvan";
public $dbpass = "123456";
public $dbname = "25thcraft";
public $connection;
public $selectdb;
public $isConnected;
public $dbh;
//$user = 'dbuser';
//$password = 'dbpass';
public function Connection()
{
try
{
$this->dbh = new PDO($this->dbhost, $this->dbuser, $this->dbpass);
// echo "true";
return $this->dbh;
}
catch(Exception $e)
{
$this->isConnected = false;
throw new Exception($e->getMessage());
}
}
public function Disconnect()
{
$this->datab = null;
$this->isConnected = false;
}
}
?>