Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $servername = "xxxx";
- $username = "xxxx";
- $password = "xxxx";
- try {
- $conn = new PDO("mysql:host=$servername;dbname=my_db", $username, $password);
- // set the PDO error mode to exception
- $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
- echo "Connected successfully";
- }
- catch(PDOException $e)
- {
- echo "Connection failed: " . $e->getMessage();
- }
- ?>
- Warning: PDO::__construct(): php_network_getaddresses: getaddrinfo failed: No such host is known. in C:xampphtdocsSitesmysqlindex.php on line 8
- Connection failed: SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo failed: No such host is known.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement