User Tools

Site Tools


pdo:exception_handling

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
pdo:exception_handling [2016/10/14 08:33] – created peterpdo:exception_handling [2020/07/15 09:30] (current) – external edit 127.0.0.1
Line 3: Line 3:
 PDO has three error handling modes. PDO has three error handling modes.
  
-  * PDO::ERRMODE_SILENT acts like mysql_* where you must check each result and then look at $db->errorInfo(); to get the error details. +  * **PDO::ERRMODE_SILENT** acts like mysql_* where you must check each result and then look at $db->errorInfo(); to get the error details. 
-  * PDO::ERRMODE_WARNING throws PHP Warnings +  * **PDO::ERRMODE_WARNING** throws PHP Warnings 
-  * PDO::ERRMODE_EXCEPTION throws PDOException. In my opinion this is the mode you should use.  It acts very much like or die(mysql_error()); when it isn't caught, but unlike or die() the PDOException can be caught and handled gracefully if you choose to do so.+  * **PDO::ERRMODE_EXCEPTION** throws PDOException. In my opinion this is the mode you should use.  It acts very much like or die(mysql_error()); when it isn't caught, but unlike or die() the PDOException can be caught and handled gracefully if you choose to do so.
  
 <code php> <code php>
Line 28: Line 28:
 </code> </code>
  
-// ...then much later...+...then much later...
  
 <code php> <code php>
pdo/exception_handling.1476434019.txt.gz · Last modified: 2020/07/15 09:30 (external edit)

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki