Advertisement
Guest User

Untitled

a guest
Feb 8th, 2018
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.63 KB | None | 0 0
  1. <?php
  2.  
  3. class DB {
  4.     //Database connection
  5.    
  6.     public static $conn;
  7.  
  8.     /**
  9.      * Connect to the database
  10.      *
  11.      * @return bool false on failure
  12.      */
  13.  
  14.     public static function getInstance(){
  15.         if(!self::$instance) {
  16.             self::$instance = new DB();
  17.         }
  18.         return self::$instance;
  19.     }
  20.    
  21.     public function connect() {
  22.         //Try and connect to the database
  23.         $host = 'helios.csesalford.com';
  24.         $user = 'stc885';
  25.         $pass = 'iv9bBshl2';
  26.         $db = 'stc885';
  27.         $conn = new mysqli($host,$user,$pass,$db);
  28.         return $conn;
  29.  
  30.     }
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement