Created
December 27, 2013 21:57
-
-
Save Piokaz/8153203 to your computer and use it in GitHub Desktop.
PHP PDO Default Mysql
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{ | |
$options = array( | |
PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8', | |
PDO::ATTR_ERRMODE => PDO::ERRMODE_WARNING, | |
PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_OBJ | |
); | |
$DB = new PDO('mysql:host=localhost;dbname=dbname', 'basename', 'password', $options); | |
}catch(PDOException $e){ | |
exit('Impossible de se connecter !'); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment