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/get_entity_new.php
<?php
header('Access-Control-Allow-Origin: *');
header('Access-Control-Allow-Methods: POST, GET, OPTIONS');
header('Access-Control-Max-Age: 1000');
header('Access-Control-Allow-Headers: Content-Type'); 
include_once 'config.php';

$id=$_REQUEST['id'];
$option = '';
$stmt = $db->prepare("SELECT link.id,entity.name FROM sp_exam_links as link left join sp_exam_entity as entity on entity.id=link.entity_id where link.exam_id='$id' order by entity.display_order asc");

$stmt->execute();
$select=$stmt->fetch(PDO::FETCH_ASSOC); 
 while($row=$stmt->fetch(PDO::FETCH_ASSOC)) { 
	$linkedId = $row['id'];
	$sqlSelctd = $db->prepare("SELECT id FROM sp_exam_links WHERE display_entity='1' and id='$linkedId'");
	$sqlSelctd->execute();
	$linkSlectd = $sqlSelctd->fetch();

	if ($linkSelected['id'] == $row['id']) {
		$option = 'selected';
	}
   $exam .= '<option value="'. $row['id'].'" '. $option.'>'.$row['name'].'</option>';
 } 
 class clsReturn {
		public $strMessage;
	}
	$arrReturn[0] = new clsReturn;
	$arrReturn[0]->strMessage =$exam;
        
echo $_REQUEST['callback'] .'(' . json_encode($arrReturn) . ')';
?>