Advertisement
Guest User

PDO correct connection test

a guest
Aug 5th, 2015
186
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.22 KB | None | 0 0
  1. try {
  2. $DBH = new PDO("mysql:host=$mysql_host;dbname=$mysql_database", $mysql_user);
  3. $DBH->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
  4. }
  5. catch (PDOException $e) {echo 'Connection failed: ' . $e->getMessage();}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement