From 6a0949ca3fe6e62be7191dc9a04df7409e76a155 Mon Sep 17 00:00:00 2001 From: m-takatsuki <26-m-takatsuki-webstar@it-college.co.jp> Date: Wed, 28 Oct 2026 15:24:50 +0900 Subject: [PATCH] =?UTF-8?q?Ex.01=E3=80=80=E5=AE=8C=E4=BA=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Ex01.php | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/Ex01.php b/Ex01.php index 02576ef..a155a86 100644 --- a/Ex01.php +++ b/Ex01.php @@ -12,3 +12,20 @@ * * ※この問題を解く前に、setup.sql を実行してデータベースをセットアップしてください。 */ + + +// DSN は "mysql:host=localhost;dbname=employee_db;charset=utf8" +$dsn = 'mysql:host=localhost;dbname=employee_db;charset=utf8'; +// データベース接続に必要なユーザ名とパスワード +$user = "rezouser"; +$password = 'Rezo_0000'; + +try{ + // 橋をかける + $dbh = new PDO($dsn, $user, $password); + echo '接続しました'; +} catch (Throwable $th){ + echo '失敗しました: ' . $th->getMessage(); + } finally { + $dbh = null; +} \ No newline at end of file