Advertisement
Guest User

Untitled

a guest
Dec 11th, 2017
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.72 KB | None | 0 0
  1. <?php
  2.     class dbConnection{
  3.         private $host;
  4.         private $port;
  5.         private $database;
  6.         private $username;
  7.         private $password;
  8.         public $connection;
  9.  
  10.         public function __construct($host,$database,$username,$password){
  11.             $this->host = $host;
  12.             $this->port = 1433;
  13.             $this->database = $database;
  14.             $this->username = $username;
  15.             $this->password = $password;
  16.             try{
  17.                 $this->connection = new PDO("sqlsrv:Server=$this->host;Database=$database",$this->username,$this->password);
  18.             }catch (PDOException $exception){
  19.                 var_dump($exception);
  20.             }
  21.            
  22.         }
  23.     }
  24. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement