Advertisement
Guest User

Untitled

a guest
May 31st, 2017
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.83 KB | None | 0 0
  1. <?php
  2. class Database
  3. {
  4.     var $ip = "";
  5.     var $name = "";
  6.     var $username = "";
  7.     var $password = "";
  8.    
  9.     var $connection;
  10.     var $error = "";
  11.  
  12.     function Configure( $s_ip, $s_name, $s_username, $s_password)
  13.     {
  14.         $this -> ip = $s_ip;
  15.         $this -> name = $s_name;
  16.         $this -> username = $s_username;
  17.         $this -> password = $s_password;
  18.     }
  19.    
  20.     function Connect()
  21.     {
  22.         $this -> connection = mysql_connect($this -> ip, $this -> username, $this -> password);
  23.         if($this -> connection)
  24.         {
  25.             $DB_connection = mysql_select_db($this -> name, $this -> connection);
  26.             if(!$DB_connection) $this -> error = "Kan database '". $this -> name ."' niet vinden";
  27.         }
  28.         else
  29.         {
  30.             $this -> error = "Kan geen verbinding maken met de database";
  31.         }
  32.     }
  33.    
  34.     function Disconnect()
  35.     {
  36.         mysql_close($this -> connection);
  37.     }
  38. }
  39. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement