<?php
	include($_SERVER['DOCUMENT_ROOT'] ."/_ps2020/config/connect.php");


	$sid=$_GET['sid'];
	
	$arr = array();
	$i = 0;
	
	$result = $conn->query("SELECT * FROM school_class WHERE school_id = '".$sid."'");
		
		if($result) {
			$classIndex = 0;

			while ( $row = $result->fetch_assoc() ){
				$classIndex++;

				$arr[$i] = array('cIndex' => $classIndex, 'cID' => $row['class_id'], 'cName' => $row['class_name']);
				$i++;
			}
		}

	$conn->close();

	echo json_encode($arr);
	// echo 1;
?>