Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class DB
- {
- private $DB_host = "stc885.csesalford.com";
- private $DB_user = "stc885";
- private $DB_pass = "iv9bBshl2";
- private $DB_name = "stc885";
- private $DB_con;
- private static $instance = null;
- private function __construct()
- {
- //try {
- $this->DB_con = new PDO("mysql:host={$this->DB_host};dbname={$this->DB_name}", $this->DB_user, $this->DB_pass);
- $this->DB_con->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
- //} catch (PDOException $e) {
- // echo $e->getMessage();
- //}
- }
- // The object is created from within the class itself
- // only if the class has no instance.
- public static function getInstance()
- {
- if (self::$instance == null)
- {
- self::$instance = new DB();
- }
- return self::$instance;
- }
- public function getConnection()
- {
- return $this->DB_con;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement