v5:reference:connection:ignoreerrors
Differences
This shows you the differences between two versions of the page.
Next revision | Previous revisionLast revisionBoth sides next revision | ||
reference:ignoreerrors [2015/07/19 23:17] – created mnewnham | v5:reference:connection:ignoreerrors [2016/01/16 23:54] – ↷ Page moved from v5:reference:ignoreerrors to v5:reference:connection:ignoreerrors mnewnham | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== ignoreErrors ====== | ====== ignoreErrors ====== | ||
~~NOTOC~~ | ~~NOTOC~~ | ||
+ | <WRAP todo> | ||
+ | This page needs expansion to describe all usages of this function | ||
+ | </ | ||
<WRAP right box> | <WRAP right box> | ||
== Syntax == | == Syntax == | ||
Line 26: | Line 29: | ||
| | ||
==== 2nd usage ==== | ==== 2nd usage ==== | ||
+ | The second usage requires the construction of the array '' | ||
+ | <code php> | ||
+ | /* | ||
+ | * database connection assumed | ||
+ | */ | ||
+ | |||
+ | /* | ||
+ | * Start a database transaction | ||
+ | */ | ||
+ | $db-> | ||
+ | |||
+ | /* | ||
+ | * Update some value successfully | ||
+ | */ | ||
+ | $db-> | ||
+ | |||
+ | </ | ||
+ | |||
+ | Do some other work, which makes us decide to rollback the transaction | ||
+ | <code php> | ||
+ | |||
+ | if ($resultOfWork == false) { | ||
+ | $currentStatus = $db-> | ||
+ | | ||
+ | /* | ||
+ | * Force the transaction to fail | ||
+ | */ | ||
+ | $currentStatus[1] = false; | ||
+ | | ||
+ | $db-> | ||
+ | } | ||
+ | |||
+ | $db-> | ||
+ | /* | ||
+ | * The transaction rolls back because the $db-> | ||
+ | * set to false | ||
+ | */ | ||
+ | </ |
v5/reference/connection/ignoreerrors.txt · Last modified: 2016/01/16 23:54 by mnewnham