Advertisement
Guest User

Untitled

a guest
Jun 10th, 2017
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.52 KB | None | 0 0
  1. <?php
  2.  
  3. class Conn {
  4.  
  5. protected $link;
  6.  
  7. private $server, $username, $password, $db;
  8.  
  9. public function __construct($server, $username, $password, $db)
  10.  
  11. {
  12.  
  13. $this->server = $server;
  14.  
  15. $this->username = $username;
  16.  
  17. $this->password = $password;
  18.  
  19. $this->db = $db;
  20.  
  21. $this->connect();
  22.  
  23. }
  24.  
  25. private function connect()
  26.  
  27. {
  28.  
  29. $this->link = mysql_connect($this->server, $this->username, $this->password);
  30.  
  31. mysql_select_db($this->db, $this->link);
  32.  
  33. }
  34.  
  35. public function __sleep()
  36.  
  37. {
  38.  
  39. mysql_close($this->link);
  40.  
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement