<?php
	session_start();

	if(!isset($_SESSION['tulsilogin']))
	{
		header('Location: index.php');
		return;
	}

	
	include("connect.php");
	
	
	 $eve = "select * from res_attendence_detail where attendencemid =".$_GET['id'];
	$re = mysqli_query($conn, $eve);

	if(mysqli_num_rows($re) > 0)
	{
		while($rt = mysqli_fetch_assoc($re))
										{
			if($rt['attendence']==0)
			{
				$eve1 = "update res_attendence_detail set attendence='1' where attendencemid=".$_GET['id'];
				$re1 = mysqli_query($conn, $eve1);
			}
			else
			{		
				$eve1 = "update res_attendence_detail set attendence='0' where attendencemid=".$_GET['id'];
				$re1 = mysqli_query($conn, $eve1);
			}
		}
	}
	
	header('Location: studentattendence.php');
?>