<?php
require 'db_connection.php';

$sql = "SELECT class_id, class_name FROM classes";
$result = $conn->query($sql);
$classes = [];

if ($result->num_rows > 0) {
    while($row = $result->fetch_assoc()) {
        $classes[] = $row;
    }
}

echo json_encode($classes);
?>
