Error message:
Error: SQLSTATE [HY000] [2002] php_network_getaddresses: getaddrinfo failed: This host is not known.
code
$db_name = 'db_name';
$hostname = 'mysql.hostinger.com.br';
$username = 'username';
$password = 'password';
$sql = "INSERT INTO atividade(titulo, descricao, data_atividade) VALUES(:titulo, :descricao, :data_atividade);";
try {
$dbh = new PDO('mysql:host=$hostname;dbname=$db_name', $username, $password);
} catch (PDOException $e) {
echo 'Error: ' . $e->getMessage();
}'
I just left the $hostname
filled correctly because it is in it that is giving the error.
If anyone can help me, thank you in advance!