Guest User

Untitled

a guest
Jan 24th, 2018
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.77 KB | None | 0 0
  1. <?php
  2. /**
  3.  * Description of DatabaseConnection
  4.  *
  5.  * @author JoRoe <TrinoxDevelopment>
  6.  */
  7. class DatabaseConnection {
  8.    
  9.     var $username;
  10.     var $password;
  11.    
  12.     function DatabaseConnection($vUsername, $vPassword)
  13.     {
  14.         $this->username = $vUsername;
  15.         $this->password = $vPassword;
  16.     }
  17.    
  18.     function openConnection()
  19.     {
  20.         $mysql_connect = mysql_connect('localhost', $username, $password);
  21.         if ($mysql_connect == false)
  22.         {
  23.             die('Could not connect: ' . mysql_error());
  24.         }
  25.     }
  26.    
  27.     function closeConnection()
  28.     {
  29.         $mysql_close = mysql_close();
  30.         if ($mysql_close == false)
  31.         {
  32.             die('Could not connect: ' . mysql_error());
  33.         }
  34.     }  
  35. }
  36.  
  37. ?>
Add Comment
Please, Sign In to add comment