<?php
include 'config.php';
header('Content-Type: application/json');

$emp_id = (int)($_GET['emp_id'] ?? 0);

if (!$emp_id) {
    echo json_encode(['salary' => null]);
    exit;
}

$stmt = $conn->prepare("
    SELECT salary 
    FROM users 
    WHERE id = ?
    LIMIT 1
");

$stmt->bind_param("i", $emp_id);
$stmt->execute();
$res = $stmt->get_result()->fetch_assoc();

echo json_encode([
    'salary' => $res['salary'] ?? null
]);
