I'm not that awesome with PDO, been learning it to update my PHP standards, I thought I had it cracked,however I keep getting an error.
I have used this before and it works and there is nothing I can see that has changed.
echo "before connect";
$conn = new PDO('mysql:host=hostadd;dbname=dbname', $username, $password);
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
echo "past connect";
This is my code, the password and server address are correct, as are the variable values that are defined before this statement.
I never make it to the past connect echo though, and I always get this error:
before connectError: SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo failed: Name or service not known
Can anyone tell me what daft mistake I am making?