Advertisement
Guest User

Untitled

a guest
Mar 7th, 2019
182
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.88 KB | None | 0 0
  1. <?php
  2.  
  3. class Connection {
  4.  
  5. private $Dabasename = 'lotto';
  6. private $hostname = 'localhost';
  7. private $username = 'Nyiko';
  8. private $password = 'Test123';
  9.  
  10. public function Connection($Dabasename, $hostname, $password, $username) {
  11. $this->hostname = $hostname;
  12. $this->username = $username;
  13. $this->password = $password;
  14. $this->Dabasename = $Dabasename;
  15.  
  16. $connection = mysqli_connect($this->hostname, $this->username, $this->password, $this->Dabasename);
  17. // $this->connection = new mysqli($host, $user, $password, $db_name);
  18.  
  19. if ($connection) {
  20. echo 'Connected';
  21. } else {
  22. echo 'not connected';
  23. }
  24. }
  25.  
  26. public function connect() {
  27. $var = $this->Dabasename. ' ' . $this->hostname . ' ' . $this->password . '' . $this->username;
  28. return $var;
  29.  
  30. }
  31.  
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement