<?php 

require 'db.php';

$cat = $con->query("select * from business_category where status = '1'");
while($rows = $cat->fetch_assoc())
{
    $p['id'] = $rows['id'];
	$p['name'] = $rows['name'];
	$a[] = $p;
}

$subcat = $con->query("select * from business_info where status = '1'");
while($rows = $subcat->fetch_assoc())
{
    $s['id'] = $rows['id'];
	$s['name'] = $rows['name'];
	$b[] = $s;
}

$prod = $con->query("select * from business_type where status = '1'");
while($row = $prod->fetch_assoc())
{
	$result['id'] = $row['id'];
    $result['name'] = $row['name'];
    $c[] = $result;
}

$prod1 = $con->query("select * from business_city where status = '1'");
while($row = $prod1->fetch_assoc())
{
	$result['id'] = $row['id'];
    $result['name'] = $row['name'];
    $d[] = $result;
}

$shop = $con->query("select * from shop_details where status = '1'");
while($row = $shop->fetch_assoc())
{
	$result['id'] = $row['id'];
    $result['name'] = $row['shop_name'];
    $e[] = $result;
}

$json_array = array(busi_category=>$a,busi_info=>$b,busi_type=>$c,busi_city=>$d,shops=>$e);
echo json_encode($json_array); 
?>