i trying move website , connect remote database, following error:
unable connect database: can't connect mysql server on 'servername' (110)
with servername being server edited (in connection file real hostname written).
i tried adding ip of new domain in cpanel under 'remote mysql' still error.
what causing this?
i don't have access php.ini files or can't change directly on server.
not duplicate because supposed duplicate doesn't provide answer, , trying connect remote database, not on same server domain.
my connection file:
<? class connection { // configure database vars private $host = 'servername'; private $username = 'username'; private $password = 'password'; private $db_name = 'dbname'; public $db; function __construct() { // create connection $db = new mysqli($this->host, $this->username, $this->password, $this->db_name); // check connection if ($db->connect_errno > 0) { die('unable connect database: '.$db->connect_error); } $this->db = $db; } public function query($query) { $db = $this->db; $this->db->query('set names utf8'); if (!$result = $this->db->query($query)) { die('there error running query ['.$db->error.']'); } else { return $result; } } public function multi_query($query) { $db = $this->db; if (!$result = $this->db->multi_query($query)) { die('there error running multi query ['.$db->error.']'); } else { return $result; } } public function real_escape_string($value) { return $this->db->real_escape_string($value); } public function inserted_id() { return $this->db->insert_id; } } //include 'artikeldb.php'; ?>
Comments
Post a Comment