Manage Classes
+ + + + + + + + + +Create a New Class
+ +Existing Classes
+ +No classes have been created yet. Use the form above to add the first one.
+ +-
+
+
- + + Created: + + +
diff --git a/admin_classes.php b/admin_classes.php new file mode 100644 index 0000000..33d65f9 --- /dev/null +++ b/admin_classes.php @@ -0,0 +1,148 @@ +prepare("INSERT INTO classes (name) VALUES (?)"); + if ($stmt->execute([$className])) { + $message = "Class '" . htmlspecialchars($className) . "' created successfully!"; + } else { + $error = 'Failed to create class.'; + } + } catch (PDOException $e) { + if ($e->errorInfo[1] == 1062) { // Duplicate entry + $error = "Error: Class '" . htmlspecialchars($className) . "' already exists."; + } else { + $error = 'Database error: ' . $e->getMessage(); + } + } + } +} + +// Fetch all classes to display +$classes = []; +try { + $pdo = db(); + $classes_stmt = $pdo->query("SELECT id, name, created_at FROM classes ORDER BY created_at DESC"); + $classes = $classes_stmt->fetchAll(PDO::FETCH_ASSOC); +} catch (PDOException $e) { + $error = 'Database error: ' . $e->getMessage(); +} + +?> + + +
+ + +No classes have been created yet. Use the form above to add the first one.
+ +No subjects have been created yet.
+ +| Name | +Double Lesson | +Elective Group | +Actions | +
|---|---|---|---|
| + | + | + | + Edit + + | +
No teachers have been created yet. Use the form above to add the first one.
+ +