Here's my code:
<?php
session_start();
$con = mysqli_connect('localhost', 'id128XXXXX', 'LXXXX');
mysqli_select_db($con, 'idXXXXXX');
$query = "select * from sensor order by id desc limit 1";
$result = mysqli_query($con, $query);
$row = mysqli_fetch_array($result);
$value = array(
"geometry"=>array(
"type"=> "Point",
"coordinates"=> [0,0] ///I want to get values from a database and put it in this bracket.
) ,
"type"=>"Feature",
"properties" => (object) array()
);
// Use json_encode() function
$json = json_encode($value);
// Display the output
echo($json);
?>
Any help regarding this will be much appreciated thank you. As for what I've tried. I tried using
"coordinates"=> [$row[longitude],$row[lat]]
ended up giving me this type of output:
{"geometry":{"type":"Point","coordinates":["0","0"]},"type":"Feature","properties":{}}
i need the ["0","0"] to be [0,0] since with the added quotation marks the map marker will not show up. And if anyone is asking I'm using mapbox and i need to output this json data for the map marker to keep refreshing.