/** Singleton connection that uses using config.php * @return dbPDO */ public static function singleton() { if (is_null(self::$_connection)) { $dsn = sprintf('mysql:host=%s;dbname=%s;port=%d', $GLOBALS['config']['mysql_host'], $GLOBALS['config']['mysql_db'], 3306); self::$_connection = new dbPDO($dsn, $GLOBALS['config']['mysql_user'], $GLOBALS['config']['mysql_pass']); } return self::$_connection; }