<?php
header('content-type:application/json');
include($_SERVER['DOCUMENT_ROOT'] . "/API-Others/connection/conn.php");
$json = file_get_contents('php://input');

$get_json = json_decode($json);
if (isset($get_json->userId)) {
    $_GET = json_decode($json, true);
}

$unique_user_id = addslashes(isset($_GET['userId']) ? $_GET['userId'] : '');
if(!empty($unique_user_id)){
    $condition = "WHERE unique_user_id = '$unique_user_id'";
}
$query = mysqli_query($conn, "SELECT * FROM staff $condition");
$config_types = array();
while ($spec = mysqli_fetch_assoc($query)) {
    $config_types[] =  $spec;
}

$query = mysqli_query($conn, "SELECT * FROM experience_area  $condition");
$experience = array();
while ($spec = mysqli_fetch_assoc($query)) {
    $experience[] =  $spec;
}


$query = mysqli_query($conn, "SELECT * FROM work_history $condition");
$work_experience = array();
while ($spec = mysqli_fetch_assoc($query)) {
    $work_experience[] =  $spec;
}




$statusCode = 200;
$statusMessage = "Signed In Successfully";

$resultData = array('code' => $statusCode, 'message' => $statusMessage, 'staff_information' => $config_types, 'experience' => $experience, 'work_experience' => $work_experience,);
echo json_encode($resultData);
