Here my PHP Script please let me know if I do something wrong.
The output of this script is showing
“You’re successfully Checked Out”
but in the database, the data isn’t sent onto it.
elseif (isset($_POST['Check-out'])) {
$time = date("Y-m-d h:i:s");
$date = date("Y-m-d h:i:s");
$emp_id = $_SESSION['user-id'];
$sql = "UPDATE `sys_attendance` SET `clock_out` = ? WHERE `emp_id` ='$emp_id' AND `c_date` ='$date'";
$stmt = mysqli_stmt_init($conn);
if (!mysqli_stmt_prepare($stmt,$sql))
{
header("Location: ../admin/home.php?error=sqlerror", true);
exit();
}
else{
mysqli_stmt_bind_param($stmt,"s",$time);
mysqli_stmt_execute($stmt);
mysqli_stmt_store_result($stmt);
$_SESSION['msg-type'] = 'success';
$_SESSION['msg-descrp'] = "You\'re Successfully Checked Out";
header("Location: ../admin/home.php?result=You-Are-Checked-Out_Now&time=".$time."&date=".$date."&emp_id=".$emp_id, true);
exit();
}
}