Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /*
- * Database Class
- * Copyright Liam Symonds
- * Authored On: 8/05/2011
- */
- class Database {
- private static $_instance;
- private static $_username = "dbUser";
- private static $_password = "dbPassword";
- private static $_host = "dbHost";
- private static $_database = "dbDB";
- private static $_dbConnection;
- private static $_dbSelection;
- public static function findInstance()
- {
- if( !isset( self::$_instance ) )
- {
- self::$_instance = new Database;
- }
- return self::$_instance;
- }
- private function __construct()
- {
- $this->_dbConnection = mysql_connect( self::$_host, self::$_username, self::$_password );
- $this->_dbSelection = mysql_select_db( self::$_database, self::_dbConnection );
- }
- }
- $db = Database::findInstance();
- ?>
Add Comment
Please, Sign In to add comment