<?php session_start(); 
include 'dbc.php';
$userid=$_SESSION["userid"];
$code=$_POST["code"];
date_default_timezone_set("Asia/Karachi");
$ttime=date("h:i:sa");
$today=date("Y-m-d");
$month = date("m",strtotime($today));
		$year = date("Y",strtotime($today));
		 $month_name = date("F", mktime(0, 0, 0, $month, 10));
		 $my=$month_name . " " . $year;
  $sqlchallan = "SELECT * FROM teacher where user_id='$userid'";
$resultchallan=$conn->query($sqlchallan);
while($pppgfine = $resultchallan->fetch_assoc())
 
  {
$teacher_id=$pppgfine["teacher_id"];
$id=$pppgfine["id"];
$tech_name=$pppgfine["tech_name"];
$fname=$pppgfine["father_name"];
$class_name=$pppgfine["class_name"];
$cell_1=$pppgfine["cell_no"];

$sql2 = "SELECT * FROM attendence_tech where date='$today' and rfid = '$teacher_id' and user_id='$userid'";
$result2=$conn->query($sql2);
$row2 = $result2->fetch_assoc();
$rollno=$row2["rollno"];
$status=$row2["status"];
$stdname=$row2["stdname"];
if ($status == "")
{
 echo   $teacher_id . $tech_name .":" . "A";
		 echo "<br>";
		$sql = "Insert into attendence_tech (id,date,rollno,stdname,fname,class_name,cls_sec,status,month_name,cell,user_id,sess1,rfid,portal_id,ttime) values (null,'$today','$id','$tech_name','$fname','$class_name','$cls_sec','A','$my','$cell_1','$userid','$year','$teacher_id','$istatus','$ttime')";
$conn->query($sql);


}
		
		

	 }
	  
		
?>
