<?php
require_once "db.php";

$emp_id = $_POST['emp_id'];
$att_date = $_POST['att_date'];

$sql = "SELECT * FROM attendance_log 
        WHERE emp_id='$emp_id' AND att_date='$att_date'";

$result = $conn->query($sql);

if ($result->num_rows > 0) {
    $row = $result->fetch_assoc();

    echo json_encode([
        "success"=>true,
        "data"=>[
            "check_in"=>$row['check_in_time'],
            "check_out"=>$row['check_out_time'],
            "status"=>$row['status'],
            "remark"=>$row['remark']
        ]
    ]);
} else {
    echo json_encode(["success"=>false]);
}
?>