Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- class Database
- {
- private static $_dbUser = 'root';
- private static $_dbPass = '';
- private static $_dbDB = 'filestatus';
- private static $_dbHost = 'localhost';
- private static $_connection = null;
- /**
- * Constructor
- * prevents new Object creation
- */
- private function __construct(){}
- /**
- * Get Database connection
- *
- * @return Mysqli
- */
- public static function getConnection() {
- if (self::$_connection===null)
- {
- self::$_connection = new mysqli(self::$_dbHost, self::$_dbUser, self::$_dbPass, self::$_dbDB);
- if (self::$_connection -> connect_error)
- {
- die('Connect Error: ' . self::$_connection->connect_error);
- }
- }
- return self::$_connection;
- }
- }
Add Comment
Please, Sign In to add comment