Created
May 24, 2017 14:33
-
-
Save Arbagen/d2888556f2bf1c479d990a6c8d44b255 to your computer and use it in GitHub Desktop.
php true pdo connection
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
$host = '127.0.0.1'; | |
$db = 'test'; | |
$user = 'root'; | |
$pass = ''; | |
$charset = 'utf8'; | |
$dsn = "mysql:host=$host;dbname=$db;charset=$charset"; | |
$opt = [ | |
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION, | |
PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC, | |
PDO::ATTR_EMULATE_PREPARES => false, | |
]; | |
$pdo = new PDO($dsn, $user, $pass, $opt); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment