I just don't get what's wrong in my code!
In browser, it shows that undefined variable!
But I declared it in a while loop before!
In browser it shows: Notice: Undefined variable: dhkBlood in C:\xampp\htdocs\JSONdata.php on line 371*
The PHP Code that I wrote is something like below:
if($retrieve1){
while($row = mysql_fetch_assoc($retrieve1))
{
$dhkBlood[] = array("ID" => $row['PID'], "PlaceName" => $row['PName'], "Address" => $row['Address'], "DeploymentName" => $row['DName'], "Latitude" => $row['Latitude'], "Longitude" => $row['Longitude']);
}
}
Code:
370. $result = array();
371. $result["dhakaBlood"]=$dhkBlood;
372. $finalResult = array();
373. $finalResult['data']=$result;
374. echo json_encode($finalResult);
P.S. $retrieve1 variable here is a variable that I used to assign a mysql query that generally retrieves information from my database!