Advertisement
Guest User

Untitled

a guest
Mar 17th, 2019
296
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.41 KB | None | 0 0
  1. $username = "123";
  2. $password = "123";
  3. $host = "localhost";
  4. $dbname = "123";
  5.  
  6. try {
  7. $dbh = new PDO('mysql:host=localhost;dbname=123', $username, $password);
  8. $dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
  9. echo "Connected";
  10.  
  11. }
  12. catch(PDOException $e) {
  13. echo "I'm sorry Charlie, I'm afraid i cant do that.";
  14. file_put_contents('PDOErrors.txt', $e->getMessage(), FILE_APPEND);
  15. $dbh = null;
  16. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement