<?php
$conn = new mysqli("localhost", "tandddri_admin", "!S0ngw3av3r1!", "tandddri_Students");
if ($conn->connect_error) {
    die("Connection failed");
}

$section_id = intval($_GET['section_id']);
$students = [];

$result = $conn->query("SELECT id, name FROM Students WHERE section_id = $section_id ORDER BY name ASC");
while ($row = $result->fetch_assoc()) {
    $students[] = $row;
}

echo json_encode($students);
$conn->close();
?>
