Guest User

Untitled

a guest
Jul 30th, 2018
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.65 KB | None | 0 0
  1. <?php
  2. class DataBase
  3. {
  4. private $host = 'localhost';
  5. private $user = 'root';
  6. private $password = '';
  7.  
  8. public function __construct()
  9. {
  10. return $this->showDataBaseConnect();
  11. }
  12.  
  13. private function showDataBaseConnect()
  14. {
  15. $connect = $this->dataBaseConnect();
  16. if ($connect){
  17. return print 'Подключение выполнено!';
  18. }
  19. else{
  20. return print 'Ошибка подключения';
  21. }
  22. }
  23.  
  24. private function dataBaseConnect()
  25. {
  26. return mysqli_connect($this->host, $this->user, $this->password);
  27. }
  28. }
  29.  
  30. $connect = new DataBase();
  31. ?>
Add Comment
Please, Sign In to add comment