title: Catching Exceptions Syntax Error in PHP
body: <p>I'm trying to use exceptions in PHP as a way of avoiding multiple <code>if-then-else</code> blocks. However, when I try to catch the exception, I get the error <code>Parse error: syntax error, unexpected T_CATCH in /directory/functions.php on line 66</code>. Am I doing something wrong with my throwing and catching?</p>
  
  <pre><code>function doThis($sSchool, $sDivision, $sClass, $sUsername, $sCode,$query1,$query2) 
      {
          connectDb();
          global $dbConnection;
  
          $sDivisionIdArray = mysqli_query($dbConnection,$query1);
          if ($sDivisionIdArray==false){throw new Exception ();}
  
  
          $sDisplayQueryArray = mysqli_query($dbConnection,$query2);
          if ($sDisplayQueryArray==false){throw new Exception ();}
  
      catch (Exception $e) // This is line 666
          {echo ('Sorry, an error was encountered.');}
      }
  </code></pre>