Created
March 11, 2016 13:33
-
-
Save skive/27e91673876c741d715b to your computer and use it in GitHub Desktop.
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 { | |
$db = new PDO($config['db_driver'] . ":dbname=" . $config['db_name'] . ";host=" . $config['db_host'], $config['db_user'], $config['db_pass']); | |
$db->setAttribute(PDO::ATTR_DEFAULT_FETCH_MODE, PDO::FETCH_NUM); | |
$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); | |
$db->setAttribute(PDO::ATTR_EMULATE_PREPARES, false); | |
$db->query("SET NAMES '{$config['db_charset']}'"); | |
} catch (PDOException $e) { | |
exit("Database connection error!"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment