Advertisement
Guest User

Untitled

a guest
Sep 9th, 2017
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.55 KB | None | 0 0
  1. <?php
  2. $dsn = 'mysql:host=localhost;dbname=MyShop';
  3. $username = 'root';
  4. $password = 'root';
  5.  
  6. /*
  7. //Option 1 - without using an error page
  8. try {
  9. $db = new PDO($dsn, $username, $password);
  10. } catch (PDOException $e) {
  11. echo $e->getMessage();
  12. exit();
  13. }
  14. */
  15.  
  16. /*
  17. //Option 1 - with an error page
  18. try {
  19. $db = new PDO($dsn, $username, $password);
  20. } catch (PDOException $e) {
  21. $error_message = $e->getMessage();
  22. include('database_error.php');
  23. exit();
  24. }
  25. */
  26. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement