tech4biz/admin/api/job-listing-get-data.php
2024-10-24 17:20:08 +05:30

45 lines
1.2 KiB
PHP

<?PHP
require_once "../db/config.php";
require_once "../includes/functions.php";
$_REQUEST_METHOD = strtoupper($_SERVER['REQUEST_METHOD']);
$response = array();
if ($_REQUEST_METHOD === 'POST') {
$getUserQuery = "SELECT * FROM `job_list_add`";
$getUser = $connection->query($getUserQuery);
if ($getUser->num_rows > 0) {
$user_array = [];
while ($user = $getUser->fetch_object()) {
$user_array[] = array(
'job_title' => $user->job_title,
'employment_type' => $user->employment_type,
'industry' => $user->industry,
'employee_status' => $user->employee_status,
'shift' => $user->shift,
'job_posted_date' => $user->job_posted_date,
'job_location' => $user->job_location,
'job_description' => $user->job_description,
);
}
$response["MESSAGE"] = "Get all contact data";
$response["CODE"] = 200;
$response["DATA"] = $user_array;
} else {
$response["MESSAGE"] = "contact does not exist";
}
} else {
$response["MESSAGE"] = "INVALID REQUEST";
}
echo json_encode($response);