Ex.01 完了
This commit is contained in:
17
Ex01.php
17
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;
|
||||
}
|
||||
Reference in New Issue
Block a user