diff --git a/.DS_Store b/.DS_Store index d29bd1f..9a38d83 100644 Binary files a/.DS_Store and b/.DS_Store differ diff --git a/03/.DS_Store b/03/.DS_Store new file mode 100644 index 0000000..1e60644 Binary files /dev/null and b/03/.DS_Store differ diff --git a/03/02_fix_this_code/index.php b/03/02_fix_this_code/index.php index 19aa44c..8c22ae0 100644 --- a/03/02_fix_this_code/index.php +++ b/03/02_fix_this_code/index.php @@ -3,22 +3,21 @@ ini_set('display_errors', 1); error_reporting(E_ALL); - -$host = "localhost" - +$host = "localhost"; $dbname = "week_two"; $username = "root"; $password = ""; -$dsn = "mysql:host=$hostdbname=$dbname"; +// DSN (Data Source Name) +$dsn = "mysql:host=$host;dbname=$dbname"; try { - - $pdo = new PDO($dsn $username,); - $pdo->setAttribute(PDO::ATTR_ERRMODE PDO::ERRMODE_SILENT); + $pdo = new PDO($dsn, $username, $password); - echo "Connected to database!"; + // Set error mode + $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); -catch (PDOException $e { - echo "Database error: " . $e + echo "Connected to database!"; +} catch (PDOException $e) { + echo "Database error: " . $e->getMessage(); } diff --git a/03/03_make_it_maintainable/footer.php b/03/03_make_it_maintainable/footer.php new file mode 100644 index 0000000..6e35977 --- /dev/null +++ b/03/03_make_it_maintainable/footer.php @@ -0,0 +1,9 @@ + +
© 2026
+