Advertisement
Guest User

Untitled

a guest
May 22nd, 2017
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.58 KB | None | 0 0
  1. class db {
  2.     static private $instance;
  3.     private $host = 'host';
  4.     private $user = 'username';
  5.     private $password = 'password';
  6.     private $db = 'database';
  7.     private $mysql;
  8.     static public function getInstance() {
  9.         if (!isset(self::$instance)) {
  10.             self::$instance == new self();
  11.         }
  12.         return self::$instance;
  13.     }
  14.     public function __construct() {
  15.         $mysql = mysql_connect($this->host, $this->user, $this->password);
  16.         if (!$link) {
  17.             die('Could not connect: ' . mysql_error());
  18.         }
  19.         if (!mysql_select_db($this->db,$mysql)) {
  20.             die('Could not connect: ' . mysql_error());
  21.         }
  22.     }
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement