<?php
require_once 'api.php';
$pdo = db();
$stmt = $pdo->prepare("SELECT * FROM employees WHERE username = 'hany'");
$stmt->execute();
$emp = $stmt->fetch();
if (!$emp) {
    echo "Employee 'hany' not found\n";
} else {
    echo "Employee ID: " . $emp['id'] . "\n";
    $stmt = $pdo->prepare("SELECT COUNT(*) FROM attendance WHERE employee_id = ?");
    $stmt->execute([$emp['id']]);
    echo "Total attendance records: " . $stmt->fetchColumn() . "\n";
    
    $stmt = $pdo->prepare("SELECT * FROM attendance WHERE employee_id = ? ORDER BY timestamp DESC LIMIT 5");
    $stmt->execute([$emp['id']]);
    $logs = $stmt->fetchAll();
    print_r($logs);
}
