Created
June 15, 2017 14:31
-
-
Save mvnp/610c4d3d5f3c5b0f44d8aad718b7b660 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$servername = "localhost"; | |
$username = "username"; | |
$password = "password"; | |
try { | |
$conn = new PDO("mysql:host=$servername;dbname=myDB", $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(); | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment