Advertisement
Guest User

Untitled

a guest
Nov 23rd, 2018
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.52 KB | None | 0 0
  1. public function connect()
  2.   {
  3.     $this->dbServer = "localhost";
  4.     $this->dbUsername = "testgebruiker";
  5.     $this->dbPassword = "1234";
  6.     $this->dbName = "userdeb";
  7.  
  8.     try
  9.     {
  10.     $connstring = "mysql:host=".$this->dbServer.";dbname=".$this->dbName."";
  11.     $this->pdo = new PDO($connstring, $this->dbUsername, $this->dbPassword);
  12.     $this->pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
  13.     }
  14.     catch(PDOException $e)
  15.     {
  16.       echo "ConnectionFailed: " . $e->getMessage();
  17.     }
  18.   }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement