Advertisement
Guest User

Untitled

a guest
Oct 23rd, 2017
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  1. <?php
  2.  
  3. class conexao{
  4. private $host= "localhost";
  5. private $user="usuariobanco";
  6. private $db="nomebanco";
  7. private $pass="senhabanco";
  8. public $conn;
  9.  
  10. public function __construct(){
  11. try{
  12. $this->conn = new PDO("mysql:host=".$this->host.";dbname=".$this->db,$this->user,$this->pass);
  13. $this->conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
  14. return true;
  15. }catch(PDOException $e){
  16. echo "ERRO: ".$e->getMessage();
  17. return false;
  18. }
  19. }
  20. }
  21. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement