title: try catch block in another try catch block
body: <p>I have the following scenario:</p>
  
  <p>In my .db.inc.php file I'm connecting to a database:</p>
  
  <pre><code>try {
      $dbh = new PDO('mysql:host=' . HOST . ';dbname=' . DATABASE , USER_DB, PASSWORD_DB);
  }
  catch (PDOException $e) {
      die('Error!: ' . $e-&gt;getMessage() . '&lt;br/&gt;');
  }
  </code></pre>
  
  <p>Then I run some functions before I need the connection, but I know that the connection is established as I don't have an error thrown.</p>
  
  <p>Now I need to update my database:</p>
  
  <pre><code>include('.db.inc.php');
  try {
  
  /...
  $sql = "UPDATE de_request_products SET report_id = :report_id WHERE request_id = :request_id";
  $stmt = $dbh-&gt;prepare($sql);
  $stmt-&gt;bindValue(':report_id', $report_number, PDO::PARAM_STR);
  $stmt-&gt;bindValue(':request_id', $report_request_number, PDO::PARAM_STR);
  $stmt-&gt;execute();
  }
  catch (PDOException $e){
  die('Error!: ' . $e-&gt;getMessage() . '&lt;br/&gt;');
  }
  </code></pre>
  
  <p>If above written try block fails, I want to have a try catch block in the Exception Handler to update the database:</p>
  
  <pre><code>// ....
  catch (PDOException $e){
    try {
  
     //SEND EMAIL AND
  
       $sql = "INSERT INTO de_failed_requests (datum, reason) VALUES (:datum, :reason)";
       $stmt = $dbh-&gt;prepare($sql);
       $stmt-&gt;bindValue(':datum', $date, PDO::PARAM_STR);
       $stmt-&gt;bindValue(':reason', $e-&gt;getMessage(), PDO::PARAM_STR);
       $stmt-&gt;execute();
     } catch (PDOException $f) {
       die('NOTHING WORKS AT ALL!'. $f-&gt;getMessage());
       }
       die('Error!: ' . $e-&gt;getMessage() . '&lt;br/&gt;');
   }
  </code></pre>
  
  <p>Would this be the way to go or is there a more efficient way?</p>