Advertisement
Guest User

Untitled

a guest
Sep 13th, 2017
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.88 KB | None | 0 0
  1. <?php
  2.  
  3. Class MySql {
  4.  
  5.     private $host = 'localhost';
  6.     private $user = 'root';
  7.     private $pass = '';
  8.     private $banco = 'teste';
  9.     private $query;
  10.  
  11.     public function SetSql($sql) {
  12.         $this->query = $sql;
  13.     }
  14.  
  15.     private function Conecta() {
  16.         try {
  17.             $dsn = 'mysql:host=' . $this->host . ';dbname=' . $this->banco;
  18.             $conecta = new PDO($dsn, $this->user, $this->pass);
  19.             $conecta->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
  20.         } catch (PDOException $erro) {
  21.             echo 'Existe um erro ao tentar conectar-se ao banco de dados confira: ' . $erro->getMessage();
  22.         }
  23.     }
  24.  
  25.    
  26.     public function Inserir(){
  27.              
  28.     }
  29.    
  30.     public function Deletar(){
  31.        
  32.     }
  33.     public function Atualizar(){
  34.        
  35.     }
  36.     public function Ler(){
  37.        
  38.     }
  39.    
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement