Modify Model.php

This commit is contained in:
Gregorio Chiko Putra 2017-08-31 13:31:52 +07:00
parent 1235bd4148
commit 5ca179fac7

View File

@ -10,19 +10,18 @@ class Model
protected static function connectDB()
{
static $conn = null;
if (!$conn) {
try {
try {
if (!$conn) {
$dsn = 'mysql:host='.Config::DB_HOST.';dbname='.Config::DB_DB;
$conn = new \PDO($dsn, Config::DB_UNAME, Config::DB_PWD);
$conn->setAttribute(\PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION);
} catch (PDOException $e) {
echo $e->getMessage();
}
return $conn;
} catch (PDOException $e) {
echo $e->getMessage();
}
return $conn;
}
public function createTable()