File: /var/www/nclive/backend/sp_exam_api/sp_exam_detail_page_api.php
<?php
ini_set('display_errors',1);
ini_set('display_startup_errors',1);
error_reporting(E_ALL);
/***sp api */
include "../config.php";
header("Access-Control-Allow-Origin: *");
header('Content-Type: application/json');
// $json = file_get_contents('php://input');
// $data = json_decode($json);
$encodeId = $_REQUEST['jsx'];
//decode function
function decodeReq($value)
{
$str = substr($value, 7);
$str1 = substr($str, 0, -6);
$decode = base64_decode($str1);
return $decode;
}
$exam_id = decodeReq($encodeId);
if (is_numeric($exam_id) && $exam_id != '' && $exam_id != '0') {
$getExamDetails = "SELECT e.exam_id,e.exam_summary, q.quali_name, e.qualification_desc, e.age_id, e.age_to, e.age_from, e.age_desc, e.fee, e.fee_desc, e.other_info, e.other_info_tabname from sp_exam as e LEFT JOIN sp_exam_category as ec ON ec.cat_id=e.cat_id LEFT JOIN sp_states as s ON s.state_id=e.state_id left join sp_qualification as q on q.qualification_id=e.qualification_id where FIND_IN_SET('$exam_id',e.sp_exam_id)";
$stmtExam = $db->prepare($getExamDetails);
$stmtExam->execute();
$dataExam = $stmtExam->fetch();
$nc_id = $dataExam['exam_id'];
if ($nc_id != '') {
/*********** elegibility,Other info & fee structure ***********/
$summary = $dataExam['exam_summary'];
$qname = $dataExam['quali_name'];
$qdesc = $dataExam['qualification_desc'];
$ageto = $dataExam['age_to'];
$agefrom = $dataExam['age_from'];
if ($ageto != '0' && $agefrom != '0') {
$age = $ageto . ' - ' . $agefrom . ' Years';
} else if ($ageto != '0' && $agefrom == '0') {
$age = 'Min ' . $ageto . ' Years';
} else if ($ageto == '0' && $agefrom != '0') {
$age = 'Max ' . $agefrom . ' Years';
} else {
$age = '';
}
$ageDesc = $dataExam['age_desc'];
$fee = $dataExam['fee'];
if ($fee != '') {
$feeD = 'Rs. ' . $fee . '/-';
} else {
$feeD = '';
}
$feeDesc = $dataExam['fee_desc'];
$response = array("status"=>1,"exam_summary"=>$summary,"qname" => $qname, "qdesc" => $qdesc, "ageData" => $age, "ageDesc" => $ageDesc, "fee_amt" => $feeD, "feeDesc" => $feeDesc, "tab_name" => $dataExam['other_info_tabname'], "tab_content" => $dataExam['other_info']);
} else {
$response = array("status" => 0, "message" => "No data found");
}
} else {
$response = array("status" => 0, "message" => "No data found");
}
echo json_encode($response);