daily pastebin goal
34%
SHARE
TWEET

Untitled

a guest Oct 23rd, 2017 66 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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. ?>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top