Exception handling in PHP

So today I ripped my hair (the few that's left) from my head, because my code didn't work as supposed, but no error was shown by my try/catch block, when accessing my database.

So this was the code I worked with:

$dsn = "mysql:host=" . DB_HOST . ";dbname=" . DB_NAME;
$dbo = new PDO($dsn, DB_USER, DB_PASS);

and I had to add this, to actually trigger some exceptions:



Add new comment

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.
Enter the characters shown in the image.