Guest User

Untitled

a guest
May 13th, 2018
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.79 KB | None | 0 0
  1. <?php
  2.  
  3. include('../configs/config.global.php');
  4.  
  5. class Database {
  6.     var $host;
  7.     var $user;
  8.     var $pass;
  9.     var $db;
  10.     var $con;
  11.  
  12.     function __construct(){
  13.         global $mysql_host;
  14.         global $mysql_user;
  15.         global $mysql_pass;
  16.         global $mysql_db;
  17.  
  18.         $this->host = $mysql_host;
  19.         $this->user = $mysql_user;
  20.         $this->pass = $mysql_pass;
  21.         $this->db = $mysql_db;
  22.  
  23.         $this->con = mysqli_connect($this->host, $this->user, $this->pass) or die(mysql_error($this->con));
  24.  
  25.         mysqli_select_db($this->db, $this->con) or die(mysql_error($this->con));
  26.     }
  27.  
  28.     public function Query($sql){
  29.         return mysqli_query($this->con, $sql);
  30.     }
  31.  
  32.     function __destruct(){
  33.         mysqli_close($this->con);
  34.     }
  35. }
  36.  
  37. ?>
Add Comment
Please, Sign In to add comment