I am trying to connect to a remote server. I think the problem is with the port number, but when I try to report errors, I get no information.
$db_host = 'MY.IP.ADD.RESS:3306';
$db_user = 'user';
$db_pass = 'password';
$db_database = 'database';
$link = mysqli_connect($db_host,$db_user,$db_pass,$db_database) or die('Unable to establish a NHT_DB connection');
if (!$link) {
die('Connect Error: ' . mysqli_connect_error());
}
else {
echo 'Success... ' . mysqli_get_host_info($link) . "\n";
}
Firstly, I am not 100% sure that the correct port. How to find out which mysql port is set to use?
Secondly, mysqli_connect_error()it doesn’t give me anything. No numbers, codes, nothing. The test page just spits back Connect Error:with not as much code as I can find.
source
share