Created
March 17, 2015 17:38
-
-
Save d8ta/09ec440ea6cd6f7b531b 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 | |
include "config.php"; | |
session_start(); | |
if ( !$DB_NAME ) | |
{ | |
die("No database connection or database does not exist"); | |
} | |
try { | |
$dbh = new PDO($DSN, $DB_USER, $DB_PASS); | |
$dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); | |
$dbh->setAttribute(PDO::ATTR_DEFAULT_FETCH_MODE, PDO::FETCH_OBJ); | |
$dbh->exec('SET CHARACTER SET utf8') ; | |
} catch (Exception $e) { | |
die("Problem connecting to database $DB_NAME as $DB_USER: " . $e->getMessage() ); | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment