Created
May 16, 2018 15:33
-
-
Save rob1121/d48338597eecfa91990ccf010bb448b5 to your computer and use it in GitHub Desktop.
connect to database using PDO
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 | |
try { | |
$conn = new PDO('mysql:host=127.0.0.1;dbname=app', 'root', ''); | |
$connt->setAttr(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); | |
} catch(PDOException $e) { | |
echo $e->getMessage(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment