public static function getConnection() { if (!self::$_connection) { //ambil semua konfigurasi di config $dbDns = Config::getConfig('dbdns'); $dbPass = Config::getConfig('dbpass'); $dbUser = Config::getConfig('dbuser'); //now koneksi dengan PDO try { self::$_connection = new PDO($dbDns, $dbuser, $dbUser); if (self::$_connection === FALSE) { throw new Exception("Koneksi Gagal"); } else { $this->konek = self::$_connection; } } catch (PDOException $e) { echo "Error : " . $e->getMessage() . "<br/>"; } } return self::$_connection; }