Skip to content

Instantly share code, notes, and snippets.

@codeforfun-jp
Created March 2, 2022 01:59
Show Gist options
  • Save codeforfun-jp/46b09b68fd8405a264c2214639cbdbe5 to your computer and use it in GitHub Desktop.
Save codeforfun-jp/46b09b68fd8405a264c2214639cbdbe5 to your computer and use it in GitHub Desktop.
【PHP】How to use transaction 4
<?php
try {
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$pdo->beginTransaction();
// 処理を行う
$pdo->commit();
} catch (Exception $e) {
$pdo->rollBack();
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment