<?php

class Db{

    private static $_instance;
    private $_conn;

    public static function getInstance(){

        //create an instance of the database if it is not already initiated
        if(!isset(self::$_instance)){
            self::$_instance = new self();
        }

        //return the database connection
        return self::$_instance;

    }


    public function __construct(){
        $this->_conn = new mysqli("localhost","ehbchqmy_phantom","Phantom@7944","ehbchqmy_phantom");
        //$this->_conn = new mysqli("westk.co.uk.mysql","westk_co_uk_hms","Hms@235","westk_co_uk_hms");
        if ($this->_conn->connect_errno) {
            die('Connect Error: ' . $mysqli->connect_errno);
        }

    }

    //prevent database clonning
    public function __clone(){}

    //
    public function getConn(){
        return $this->_conn;
    }

}

?>
