Advertisement
Guest User

Untitled

a guest
May 17th, 2017
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.64 KB | None | 0 0
  1. <?php
  2.  
  3. class myDatabase
  4. {
  5.     private $host = 'localhost';
  6.     private $username = 'root';
  7.     private $password = '';
  8.  
  9.     public function connect()
  10.     {
  11.         $this->con = mysql_connect($this->host,$this->username,$this->password);
  12.        
  13.         if (!$this->con)
  14.             return false;
  15.         else
  16.             return true;
  17.     }
  18.    
  19.     public function query($TheQuery)
  20.     {
  21.         if (mysql_query($TheQuery,$this->con))
  22.             return true;
  23.         else
  24.             return false;
  25.     }
  26.    
  27.     public function selectdb($DbName)
  28.     {
  29.         if (mysql_select_db($DbName, $this->con))
  30.             return true;
  31.         else
  32.             return false;
  33.     }
  34.    
  35.     public function disconnect()
  36.     {
  37.         mysql_close($this->con);
  38.     }
  39. }
  40.  
  41. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement