Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- class db {
- static private $instance;
- private $host = 'host';
- private $user = 'username';
- private $password = 'password';
- private $db = 'database';
- private $mysql;
- static public function getInstance() {
- if (!isset(self::$instance)) {
- self::$instance = new self();
- }
- return self::$instance;
- }
- public function __construct() {
- $mysql = mysql_connect($this->host, $this->user, $this->password);
- if (!$mysql) {
- die('Could not connect: ' . mysql_error());
- }
- if (!mysql_select_db($this->db,$mysql)) {
- die('Could not connect: ' . mysql_error());
- }
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement