I\'m trying to create a json object from MySQL results, but not getting the result I need.
Here is the PHP
$json = array();
$result = m
I guess the correct way to do this would be:
$json = array();
$result = mysqli_query ($connection, $query);
while($row = mysqli_fetch_array ($result))
{
$bus = array(
'latitude' => $row['lat'],
'longitude' => $row['lng'],
'icon' => './images/' . $row['busColor'] . '.png'
);
array_push($json, $bus);
}
$jsonstring = json_encode($json);
echo $jsonstring;
die();