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


	$code=$_GET['code'];
	// echo "no code is found";

	$result = $conn->query("SELECT * FROM school_class,school");
		
		if($result) {
			while ( $row = $result->fetch_assoc() ){
				
				// echo 'no code is found';
				if ($row['specific_classCode'] == $code){
					echo "<span>Student</span>";
					echo "<br>";
					echo "<span>class: ".$row['class_name']."</span>";
				}
				else if ($row['specific_staffCode'] == $code){
					echo "<span>Teachers</span>";
				}
				else{
					echo "<span>the code is invalid</span>";
				}
				
			}
		}

	$conn->close();
?>