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

ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);

$json = file_get_contents('php://input');
$data = json_decode($json);
$slug = $data->state;

$getStateDataQuery = "select state_name, state_slug, state_code, state_img, state_description, state_adv, latitude, longitude from sp_states where state_slug='$slug' ";
$getStateData = $db->prepare($getStateDataQuery);
$getStateData->execute();

	$data = array();
	
	while($exRes=$getStateData->fetch()){
		
		if($exRes['state_img']==''){
			$stateImage = "state_common_banner.png";
		} else {
			$stateImage = $exRes['state_img'];
		}
		
		$nestedData = array();
		$nestedData["state_name"] = $exRes['state_name'];
		$nestedData["state_slug"] = $exRes['state_slug'];
		$nestedData["state_code"] = $exRes['state_code'];
		$nestedData["state_img"] = $stateImage;
		$nestedData["state_description"] = $exRes['state_description'];
		$nestedData["state_adv"] = $exRes['state_adv'];
		$nestedData["latitude"] = $exRes['latitude'];
		$nestedData["longitude"] = $exRes['longitude'];
		
		$data[] = $nestedData;
	}

		$json_data = array($data);
				
		echo json_encode($json_data);

?>