<?php
include("../../config/database.php");
$conct  = new connectionCreat();
$conct->connectToDB();
$conct->selectDB();
$atten				= $_GET['atten'];
$atten_dt			= date("Y-m-d",strtotime($_GET['atten_dt']));
$emp_id				= $_GET['emp_id']; 
$state				= $_GET['state'];
$sql				= mysql_query("SELECT * FROM `tbl_attendence` where `emp_id`='$emp_id' and `date`='$atten_dt' ")or die(mysql_error());
if(mysql_num_rows($sql)==0)
{
	$sql_2			= mysql_query("insert into `tbl_attendence` set `emp_id`='$emp_id', `state`='$state', `date`='$atten_dt', `mark`='$atten' ")or die(mysql_error());		
}
else
{
	$sql_2			= mysql_query("update `tbl_attendence` set `emp_id`='$emp_id', `state`='$state', `date`='$atten_dt', `mark`='$atten' where `emp_id`='$emp_id' and `date`='$atten_dt' ")or die(mysql_error());		
	
}
$sql_3				= mysql_query("SELECT `details` FROM `tbl_attend_type` where `id`='$atten' ORDER BY `sort_order` ASC  ");
$data_3				= mysql_fetch_array($sql_3);
echo "<p style='color:green'>".$data_3['details']."</p>";
mysql_close();
?>