Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- class conexao{
- private $host= "localhost";
- private $user="usuariobanco";
- private $db="nomebanco";
- private $pass="senhabanco";
- public $conn;
- public function __construct(){
- try{
- $this->conn = new PDO("mysql:host=".$this->host.";dbname=".$this->db,$this->user,$this->pass);
- $this->conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
- return true;
- }catch(PDOException $e){
- echo "ERRO: ".$e->getMessage();
- return false;
- }
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement