daily pastebin goal
8%
SHARE
TWEET

Untitled

a guest Aug 10th, 2018 107 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2. class db{
  3.  
  4.     private $host = "localhost";
  5.     private $username = "root";
  6.     private $password = "";
  7.     private $db_name = "mydb";
  8.     private $conn;
  9.  
  10.     protected function connect(){
  11.  
  12.         $this->conn = new mysqli($this->host, $this->username, $this->password, $this->db_name);
  13.        
  14.         if (mysqli_connect_errno()){
  15.             printf("Connect failed: %s\n", mysqli_connect_error());
  16.             exit();
  17.         }
  18.         return $this->conn;
  19.     }
  20. }
  21. ?>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top