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

	$sid = $_GET["sid"];
	$sOrder = $_GET["sOrder"];

		// if ($result = $conn->query("DELETE FROM school WHERE school_id='".$sid."'") === TRUE) {
		// 	$result = $conn->query("UPDATE school SET school_id='".$sOrder."' WHERE school_id>'".$sOrder."'");
		// }

		//now that the school itself has been removed
		if($result = $conn->query("DELETE FROM school WHERE school_id = '$sid'") === TRUE){
			//Now we will remove all classes in that school
			if($result = $conn->query("DELETE FROM school_class WHERE school_id = '$sid'") === TRUE){
				//Now that all classes have been deleted
				//we need to change the accounttype of all users related to particpant type
				$result = $conn->query("UPDATE user_account SET accountType = '0', school_id = '0', class_id = '0' WHERE school_id = '$sid'");
			}
		}


   $conn->close();
?>