Advertisement
Guest User

Untitled

a guest
Jun 27th, 2017
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.66 KB | None | 0 0
  1. <?php
  2.  
  3. class MySQL{
  4.  
  5.     private $hote;
  6.     private $port;
  7.     private $dbName;
  8.     private $user;
  9.     private $password;
  10.     private $connect;
  11.    
  12.     public function __construc($hote, $port, $dbName, $user, $password) {
  13.    
  14.         $this->hote     = $hote;
  15.         $this->port     = $port;
  16.         $this->dbName   = $dbName;
  17.         $this->user     = $user;
  18.         $this->password = $password;
  19.    
  20.    
  21.     }
  22.  
  23.     public function DBConnect() {
  24.    
  25.         try
  26.         {
  27.             $this->connect = new PDO('mysql:host='.$this->hote.';dbname='.$this->dbName, $this->user, $this->password);
  28.         }
  29.      
  30.         catch(Exception $e)
  31.         {
  32.             echo 'Erreur : '.$e->getMessage().'<br />';
  33.             echo 'N° : '.$e->getCode();
  34.         }
  35.    
  36.     }
  37.    
  38.    
  39.    
  40.     }
  41.  
  42.  
  43.  
  44. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement