Guest User

Untitled

a guest
Mar 7th, 2018
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.63 KB | None | 0 0
  1. class Database
  2. {
  3.     private $db_host = '';
  4.     private $db_user = '';
  5.     private $db_pass = '';
  6.     private $db_name = '';
  7.    
  8.     private $con = false;
  9.     private $result = array();
  10.    
  11.     public function connect()
  12.     {
  13.         $this->db_host = Config::item('host');
  14.         if(!$this->con)
  15.         {
  16.             $myconn = @mysql_connect($this->db_host, $this->db_user, $this->db_pass);
  17.             if($myconn)
  18.             {
  19.                 $seldb = @mysql_select_db($this->db_name, $myconn);
  20.                 if($seldb)
  21.                 {
  22.                     $this->con = true;
  23.                     return true;
  24.                 }
  25.                 else
  26.                 {
  27.                     return false;
  28.                 }
  29.             }
  30.             else
  31.             {
  32.                 return false;
  33.             }
  34.         }
  35.         else
  36.         {
  37.             return true;
  38.         }
  39.     }
  40. }
Add Comment
Please, Sign In to add comment