Last active
August 29, 2015 14:06
-
-
Save YupItsZac/a05a82f0748499f6c03d to your computer and use it in GitHub Desktop.
Connect to MySQL with PDO
This file contains 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
try { | |
$conn = new PDO('mysql:host=localhost;dbname=myDatabase', $username, $password); | |
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); | |
} catch(PDOException $e) { | |
echo 'ERROR: ' . $e->getMessage(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment