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/backend/get_all_state_data.php
<?php
header("Access-Control-Allow-Origin: *");
header('Content-Type: application/json');
include "config.php";


$query="Select DISTINCT(state_id) as s from sp_exam where state_id!='' ";
$sql=$db->prepare($query);
$sql->execute();

while($row=$sql->fetch()){
$state_id=$row['s'];

$qery2="select exam_name from sp_exam where state_id='$state_id'";
$sql2=$db->prepare($query2);
$sql2->execute();


while($row2 = $sql2->fetch()){
$exam= $row['exam_name'];	
$array = array("name"=>$exam);
$mainarray[]=$array;
} 
$array2=array("id"=>$state_id,"exam"=>$mainarray);
$main[]=$array2;
}

echo json_encode($main , TRUE);




?>