File: /var/www/nclive/backend/state_other_link_data.php
<?php
header("Access-Control-Allow-Origin: *");
header('Content-Type: application/json');
include "config.php";
$slug=$_REQUEST['state'];
$getLinksQuery = "select sol.post_name, sol.post_slug, sol.summary from sp_other_links as sol where sol.status='1' and sol.state_slug='$slug' order by sol.post_name";
$getLinksData = $db->prepare($getLinksQuery);
$getLinksData->execute();
$data = array();
while($exRes=$getLinksData->fetch()){
$nestedData = array();
$nestedData["post_name"] = $exRes['post_name'];
$nestedData["post_slug"] = $exRes['post_slug'];
$nestedData["summary"] = strip_tags($exRes['summary']);
$data[] = $nestedData;
}
$json_data = array($data);
echo json_encode($json_data);
?>