<?php
// Database connection
include('../includes/dbconnection.php');

// Fetch terms
$sql = "SELECT id, term_name FROM school_terms ORDER BY id";
$result = $con->query($sql);

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

echo json_encode($terms);
$con->close();
?>