<?php
require("includes/check_auth_user.php");
require("includes/dbconnect.php");
include('includes/function.php');

$zdb = $_SESSION["zdbyear_" . $dbname];
$admin = $_SESSION["admin_" . $dbname];
mysqli_select_db($conn, $zdb);

if (isset($_GET["empcode"])) {
    $empcode = $_GET["empcode"];

    $getdeptcode = mysqli_query($conn, "SELECT `deptcode` FROM `accmast` WHERE `accode`='$empcode'")or die(mysqli_error($conn));
    $fetdeptcode = mysqli_fetch_array($getdeptcode);
    $deptcode = $fetdeptcode['deptcode'];

    header('Content-Type: application/json');
    echo json_encode(array('deptcode' => $deptcode));
}
?>