Guest User

Untitled

a guest
Feb 7th, 2018
85
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. protected $db_host = "localhost";
  6. protected $db_user = "root2"; //здесь специально произведена ошибка. Верное выражение - root в данном случае.
  7. protected $db_pass = "1111";
  8. protected $db_name = "program";
  9. protected $mysqli;
  10.  
  11.  
  12. public function connect()
  13. {
  14. try
  15. {
  16. $this->mysqli = new mysqli($this->db_host, $this->db_user, $this->db_pass, $this->db_name);
  17. }
  18. catch(Exception $expection)
  19. {
  20. echo 'Connection error: ' . $expection->getMessage();
  21. }
  22. }
  23.  
  24. }
  25.  
  26. $database = new Database;
  27. $database->connect();
  28. ?>
Add Comment
Please, Sign In to add comment