Subjects & Classes
= htmlspecialchars($_SESSION['success_message']) ?>
= htmlspecialchars($_SESSION['error_message']) ?>
exec(file_get_contents('db/migrations/007_create_classes_table.sql')); } if (file_exists('db/migrations/008_create_subjects_table.sql')) { $pdo->exec(file_get_contents('db/migrations/008_create_subjects_table.sql')); } // Fetch classes $stmt_classes = $pdo->query("SELECT id, name FROM classes ORDER BY name"); $classes = $stmt_classes->fetchAll(); // Fetch subjects $stmt_subjects = $pdo->query("SELECT id, name FROM subjects ORDER BY name"); $subjects = $stmt_subjects->fetchAll(); } catch (Exception $e) { die("Could not connect to the database: " . $e->getMessage()); } ?>