Silakan mengisi daftar isian yang disediakan.
[insert_php]
class Database
{
private static $dbName = ‘rumq1296_ks212’ ;
private static $dbHost = ‘localhost’ ;
private static $dbUsername = ‘rumq1296_admin’;
private static $dbUserPassword = ‘m4t3m4n1a’;
private static $cont = null;
public function __construct() {
die(‘Init function is not allowed’);
}
public static function connect()
{
// One connection through whole application
if ( null == self::$cont )
{
try
{
self::$cont = new PDO( “mysql:host=”.self::$dbHost.”;”.”dbname=”.self::$dbName, self::$dbUsername, self::$dbUserPassword);
}
catch(PDOException $e)
{
die($e->getMessage());
}
}
return self::$cont;
}
public static function disconnect()
{
self::$cont = null;
}
}
[/insert_php]