Update database.php

This commit is contained in:
Namhyeon Go 2017-12-31 23:50:25 +09:00 committed by GitHub
parent ac4c123fc0
commit b3b560356d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -9,4 +9,19 @@ $conn = new PDO(
$config['db_password'],
array(PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES utf8")
);
$conn->query("SET NAMES 'utf8'");
$conn->query("SET NAMES 'utf8'");
if(!function_exists("sql_query")) {
function sql_query($sql, $bind=array()) {
global $conn;
$stmt = $conn->prepare($sql);
if(count($bind) > 0) {
foreach($bind as $k=>$v) {
$stmt->bindParam(':' . $k, $v);
}
}
return $stmt->execute();
}
}