0
I’m having a doubt when I change my credentials of the database at localhost for the credentials of the database at sql server give me this php error
Warning: mysqli::__construct(): php_network_getaddresses: getaddrinfo failed: Este anfitrião não é conhecido. in C:\xampp\htdocs\Contactos_BD\conexao.php on line 6
Warning: mysqli::__construct(): (HY000/2002): php_network_getaddresses: getaddrinfo failed: Este anfitrião não é conhecido. in C:\xampp\htdocs\Contactos_BD\conexao.php on line 6
Code:
$host="*host*";
$usuario="*user**";
$senha="*pass**";
$bd="*bd**";
$mysqli= new mysqli($host,$usuario,$senha,$bd);
$mysqli=mysqli_connect($host,$usuario,$senha,$bd);
if ($mysqli->connect_error) {
die('Connect Error (' . $mysqli->connect_errno . ') '
. $mysqli->connect_error);
}
It seems to me that they are wrong. You can connect with them directly in the bank without PHP?
– Woss
Yes, by localhost the problem is that when I enter the server credentials it does not give, sql management studio enters and I can run query’s without problem (with the same credentials as the server)
– Gonçalo Garrido
Could [Edit] ask the question and add how you are making the connection? Remember to change the user and password before posting here for security.
– Woss
Is already up to date!
– Gonçalo Garrido
It’s a problem with Host.
– Augusto Vasques
So how can I fix?
– Gonçalo Garrido
Two possibilities: you’re trying to access an incorrect host, so we can’t help you, because we don’t know what it is. Another is: your database host has a firewall and only allows a certain range of Ips to access, and your php script is on another server with IP that is not of the allowed range.
– Guilherme Nascimento