Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class db {
- static private $instance;
- private $host = 'localhost';
- private $user = 'username';
- private $password = 'password';
- private $db = 'database';
- private $mysqli;
- static public function getInstance() {
- if (!isset(self::$instance)) {
- self::$instance == new self();
- }
- return self::$instance;
- }
- public function __construct() {
- $mysqli = new mysqli($this->host,$this->user,$this->password,$this->db);
- if (mysqli_connect_errno()) {
- printf("Error %s\n".mysqli_connect_error());
- exit;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement