Advertisement
Guest User

Untitled

a guest
May 22nd, 2017
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.53 KB | None | 0 0
  1. class db {
  2.     static private $instance;
  3.     private $host = 'localhost';
  4.     private $user = 'username';
  5.     private $password = 'password';
  6.     private $db = 'database';
  7.     private $mysqli;
  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.         $mysqli = new mysqli($this->host,$this->user,$this->password,$this->db);
  16.         if (mysqli_connect_errno()) {
  17.             printf("Error %s\n".mysqli_connect_error());
  18.             exit;
  19.         }
  20.     }
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement