Advertisement
phpbego

Koneksi

Jul 9th, 2014
377
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.57 KB | None | 0 0
  1. <?php
  2. // http://phpbego.wordpress.com
  3.  
  4. class Koneksi {
  5.  
  6.     private $host = "localhost";
  7.     private $user = "root";
  8.     private $pass = "faiz";
  9.     private $dbname = "dbsimplekrsmpdf";
  10.     private $db_connection = null;
  11.    
  12.     public function getConnection() {
  13.         $this->db_connection = new mysqli($this->host, $this->user, $this->pass, $this->dbname);   
  14.         if ($this->db_connection->connect_errno) {
  15.             echo "Failed to connect to Database: (" . $this->db_connection->connect_errno . ") " . $this->db_connection->connect_error;
  16.         } else {
  17.             return $this->db_connection;
  18.         }
  19.     }
  20.    
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement