HEX
Server: Apache/2.4.58 (Ubuntu)
System: Linux ip-172-31-18-78 6.17.0-1017-aws #17~24.04.1-Ubuntu SMP Tue May 26 21:09:53 UTC 2026 aarch64
User: ubuntu (1000)
PHP: 8.2.31
Disabled: NONE
Upload Files
File: /var/www/nclive/technc/physical_eligibility_list_data.php
<?php
	header("Access-Control-Allow-Origin: *");
	header('Content-Type: application/json');	

	include 'config.php';

	$requestData = $_REQUEST;
	$columns = array(
		0 => 'id',
		1 => 'exam_id',
		2 => 'exam_name',
		3 => 'gender',
		4 => 'categories',
	    5 => 'height',
	    6 => 'chest',
	    7 => 'race',
		8 => 'time',
		9 => 'long_jump',
		10 => 'high_jump',
		11 => 'short_put',
		12 => 'chances',
		13 => 'status'
	);

	$getDataQuery  = "SELECT pe.id,pe.exam_id,pe.gender,pe.categories,pe.height,pe.chest,pe.race, pe.time,pe.long_jump,pe.high_jump,pe.short_put,pe.chances,pe.status,exams.exam_name FROM sp_physical_eligibility AS pe LEFT JOIN sp_exam AS exams ON exams.exam_id=pe.exam_id WHERE pe.exam_id !='' ";
	$getData=$db->prepare($getDataQuery);
	$getData->execute();
	$totalData = $getData->rowCount();
	$totalFiltered = $totalData;

	$searchTerms = "";
	if (!empty($requestData['search']['value'])) {
		$searchTerms .= " AND ( pe.exam_id LIKE '" . $requestData['search']['value'] . "%' ";
		$searchTerms .= " OR pe.gender LIKE '%" . $requestData['search']['value'] . "%' ";
		$searchTerms .= " OR pe.categories LIKE '%" . $requestData['search']['value'] . "%' ";
		$searchTerms .= " OR pe.height LIKE '%" . $requestData['search']['value'] . "%' ";
		$searchTerms .= " OR exams.exam_name LIKE '%" . $requestData['search']['value'] . "%' ) ";
	}

	$getDataQuery  = "SELECT pe.id,pe.exam_id,pe.gender,pe.categories,pe.height,pe.chest,pe.race, pe.time,pe.long_jump,pe.high_jump,pe.short_put,pe.chances,pe.status,exams.exam_name FROM sp_physical_eligibility AS pe LEFT JOIN sp_exam AS exams ON exams.exam_id=pe.exam_id WHERE pe.exam_id !='' $searchTerms";

	$getData=$db->prepare($getDataQuery);
	$getData->execute();
	$totalFiltered = $getData->rowCount();

	$getDataQuery .= " ORDER BY " . $columns[$requestData['order'][0]['column']] . " " . $requestData['order'][0]['dir'] . "  LIMIT " . $requestData['start'] . ", " . $requestData['length'] . "   ";

	$getData=$db->prepare($getDataQuery);
	$getData->execute();

	$data = array();
	while ($querydata = $getData->fetch()) {

		$nestedData = array();
		$nestedData["id"] = $querydata['id'];
		$nestedData["exam_id"] = $querydata['exam_id'];
		$nestedData["exam_name"] = $querydata['exam_name'];
		$nestedData["gender"] = $querydata['gender'];
		$nestedData["categories"] = $querydata['categories'];
		$nestedData["height"] = $querydata['height'];
	    $nestedData["chest"] = $querydata['chest'];
	    $nestedData["race"] = $querydata['race'];
	    $nestedData["time"] = $querydata['time'];
	    $nestedData["long_jump"] = $querydata['long_jump'];
	    $nestedData["high_jump"] = $querydata['high_jump'];
	    $nestedData["short_put"] = $querydata['short_put'];
	    $nestedData["chances"] = $querydata['chances'];
	    $nestedData["status"] = $querydata['status'];
		$data[] = $nestedData;
	}

	$json_data = array(
		"draw"            => intval($requestData['draw']),
		"recordsTotal"    => intval($totalData),
		"recordsFiltered" => intval($totalFiltered),
		"data"            => $data
	);
	echo json_encode($json_data);
?>