<?php
session_start();
include('../permission/connect_sql.php');

$sql = "SELECT [UserID],[Account],[UserName],[DepartmentID] FROM [User] WHERE [DepartmentID] = ?";
$stmt = sqlsrv_query($conn, $sql, array($_SESSION['UserID']));
$users = array();
while ($row = sqlsrv_fetch_array($stmt, SQLSRV_FETCH_ASSOC)) {
    $temp = array();
    $temp["UserID"] = $row["UserID"];
    $temp["Account"] = $row["Account"];
    $temp["UserName"] = $row["UserName"];
    $temp["DepartmentID"] = $row["DepartmentID"];
    array_push($users, $temp);
}
echo json_encode($users);
