Created
April 13, 2015 04:25
-
-
Save duyet/906eaa898574a324a23e 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'); | |
try { | |
$pdo = new PDO("mysql:host=$hostname;dbname=$dbname;charset=utf8", "$username", "$pw", array(PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES utf8")); | |
$pdo->exec("set names utf8"); | |
$pdo->exec("set character_set_client='utf8'"); | |
$pdo->exec("set character_set_results='utf8'"); | |
$pdo->exec("set character_set_connection='utf8_general_ci'"); | |
error_reporting(E_ALL & ~E_NOTICE & ~E_DEPRECATED); | |
} catch(PDOException $e) { | |
echo "File to get DB handle: " . $e->getMessage() . "\n"; | |
exit; | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment