File: /var/www/nclive/backend/state_institutions_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;
$getINSTQuery = "select ins.institutions_name, ins.address, ins.pincode, ins.official_website_link, ins.online_apply_link, ins.online_fee_link, ins.result_link, s.state_name, c.city, cat.category_name from sp_institutions as ins INNER JOIN sp_institutions_category as cat ON cat.id=ins.category_id INNER JOIN sp_states as s ON s.state_id=ins.state_id LEFT JOIN sp_city as c on c.city_id=ins.city_id where ins.status='1' and s.state_slug='$slug' order by ins.institutions_name";
$getINSTData = $db->prepare($getINSTQuery);
$getINSTData->execute();
$data = array();
while($instRes=$getINSTData->fetch()){
$nestedData = array();
$nestedData["image_icon"] = 'https://www.prokerala.com/education/imgs/logo/school/jawahar-navodaya-vidyalaya.jpg';
$nestedData["institutions_name"] = $instRes['institutions_name'];
$nestedData["address"] = $instRes['address'];
$nestedData["pincode"] = $instRes['pincode'];
$nestedData["state_name"] = $instRes['state_name'];
$nestedData["city"] = $instRes['city'];
$nestedData["official_website_link"] = $instRes['official_website_link'];
$nestedData["online_apply_link"] = $instRes['online_apply_link'];
$nestedData["online_fee_link"] = $instRes['online_fee_link'];
$nestedData["result_link"] = $instRes['result_link'];
$nestedData["category_name"] = $instRes['category_name'];
$data[] = $nestedData;
}
$json_data = array($data);
echo json_encode($json_data);
?>