Advertisement
evta

db_class.php

Feb 19th, 2018
74
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. class database{
  3.    // properti
  4.    private $dbHost;
  5.    private $dbUser;
  6.    private $dbPass;
  7.    private $dbName;
  8.    public $mysqli;
  9.    
  10.     function __construct(){
  11.        $this->dbHost="localhost";
  12.        $this->dbUser="root";
  13.        $this->dbPass="12345";
  14.        $this->dbName="perpustakaan";
  15.        $this->mysqli   = new mysqli($this->dbHost, $this->dbUser, $this->dbPass, $this->dbName);
  16.        
  17.         /* check connection */
  18.         if (mysqli_connect_errno()) {
  19.             printf("Connect failed: %s\n", mysqli_connect_error());
  20.             exit();
  21.         }
  22.         else {//echo "Koneksi Berhasil";
  23.         }
  24.     }
  25. }
  26.  
  27. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement