This question already has an answer here:
I am trying to convert my $response
array to JSON but it is not converting. I tried to echo the values in the array to be sure that it is not null.
if($row['count(*)']>0)
{
$sql="select * from guide_city_detail where CITY='$place'";
$result = $conn->query($sql);
$row = $result1->fetch_assoc();
$row = array_map('utf8_encode', $row);
$response['status']=1;
$response['city']=$row['CITY'];
$response['state']=$row['STATE'];
$response['country']=$row['COUNTRY'];
$response['heads']=$row['HEADS'];
$response['col1']=$row['COL1'];
$response['col2']=$row['COL2'];
$response['col3']=$row['COL3'];
$response['col4']=$row['COL4'];
$response['col5']=$row['COL5'];
$response['col6']=$row['COL6'];
$response['col7']=$row['COL7'];
$response['col8']=$row['COL8'];
$response['col9']=$row['COL9'];
//echo $response['country'];
}
else
{
$response['status']=0;// save the entry for future references
$output = shell_exec("java -cp \".;D:/letsgo/mysql.jar;D:/letsgo/jsoup.jar;\" GeneralPopulate $place 2>&1");
//echo "$output";
}
$res=json_encode($response);
echo $res;
}
</div>