Guest User

Untitled

a guest
Aug 10th, 2018
154
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.42 KB | None | 0 0
  1. <?php
  2. class db{
  3.  
  4. private $host = "localhost";
  5. private $username = "root";
  6. private $password = "";
  7. private $db_name = "mydb";
  8. private $conn;
  9.  
  10. protected function connect(){
  11.  
  12. $this->conn = new mysqli($this->host, $this->username, $this->password, $this->db_name);
  13.  
  14. if (mysqli_connect_errno()){
  15. printf("Connect failed: %s\n", mysqli_connect_error());
  16. exit();
  17. }
  18. return $this->conn;
  19. }
  20. }
  21. ?>
Add Comment
Please, Sign In to add comment