Advertisement
Guest User

Untitled

a guest
Jul 20th, 2017
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.76 KB | None | 0 0
  1. <?php
  2.  
  3. class Connect
  4. {
  5.  
  6. protected $db_host='localhost';
  7. protected $db_name='gaska';
  8. protected $db_user='root';
  9. protected $db_pass='';
  10. protected $DB = null;
  11. protected $query;
  12.  
  13.  
  14. public function connect()
  15. {
  16. try
  17. {
  18. $this->DB = new PDO("mysql:host=".$this->db_host.";dbname=".$this->db_name."", $this->db_user, $this->db_pass);
  19.  
  20. }
  21. catch(PDOException $e)
  22. {
  23. echo 'Informacja developerska: '.$e->getMessage();
  24. }
  25. }
  26. public function query()
  27. {
  28. try {
  29.  
  30. $query=$this->DB ->query("SELECT * FROM users");
  31. }
  32. catch (Exception $e) {
  33. echo 'Informacja developerska: ' . $e->getMessage();
  34. }
  35. }
  36.  
  37. }
  38.  
  39. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement