Skip to content

Instantly share code, notes, and snippets.

@codeforfun-jp
Created March 2, 2022 01:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save codeforfun-jp/0e2bbb416111f1c397c75654eae47fdd to your computer and use it in GitHub Desktop.
Save codeforfun-jp/0e2bbb416111f1c397c75654eae47fdd to your computer and use it in GitHub Desktop.
【PHP】How to use transaction 1
<?php
$dbname = 'test';
$host = 'localhost';
$user = 'root';
$password = 'root';
// データベース接続
try {
$pdo = new PDO('mysql:dbname='.$dbname.';host='.$host, $user, $password);
echo 'データベースに接続しました。<br><br>';
} catch (PDOException $e) {
exit($e->getMessage());
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment