Advertisement
Guest User

Untitled

a guest
Sep 5th, 2016
136
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. <?php
  2. class Database_connection {
  3.  
  4. private $db_host = "local";
  5. private $db_name = "root";
  6. private $db_user = "user";
  7. private $db_pass = "pass";
  8. protected $db_holder;
  9.  
  10. protected function open_connection() {
  11. $this->db_holder = new PDO($this->db_host.$this->db_name, $this->db_user, $this->db_pass);
  12. }
  13.  
  14. protected function close_connection() {
  15. $this->db_holder = null;
  16. }
  17.  
  18. }
  19. ?>
  20.  
  21. new PDO('mysql:host=localhost;dbname=base', $usuario, $senha);
  22.  
  23. new PDO($this->db_host
  24.  
  25. new PDO('mysql:host='. $this->db_host .';dbname='.$this->db_name, $this->db_user, $this->db_pass);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement