Advertisement
Guest User

Untitled

a guest
Apr 21st, 2016
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.61 KB | None | 0 0
  1. <?php
  2.  
  3. class Database {
  4.  
  5. private $host = "localhost";
  6. private $user = "db_forum";
  7. private $pass = "XXX";
  8. private $name = "db_forum";
  9.  
  10. public function connect() {
  11.  
  12. $this->host = $host;
  13. $this->user = $user;
  14. $this->pass = $pass;
  15. $this->name = $name;
  16.  
  17. // Create connection
  18. $conn = new mysqli($host, $user, $pass);
  19.  
  20. // Check connection
  21. if ($conn->connect_error) {
  22. die("Connection failed: " . $conn->connect_error);
  23. }
  24.  
  25. echo "Connected successfully";
  26.  
  27. } // end connect method
  28.  
  29. public function disconnect() {
  30. $conn->close();
  31. }
  32. }
  33. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement