对Geojson的PDOStatement

In order to use it in leaflet, i need to convert my data queried from Mysql with PDO to geojson format.

I find here a solution to do that for json with json_encode(), but i can't find an analogical geojson_encode() function or algorithme with php.

so is there a solution ?

I Solved My problem by reading this issue

to have your queried data from Mysql converted to geojson , just try this code :

$geojson = array(
    'type'      => 'FeatureCollection',
   'features'  => array()
);

$reponses=$bdd->query('SELECT * FROM `nyc_taxi_data_2014` LIMIT 0,30 ');

    while ($data=$reponses->fetch())
    {
        $marker = array(
            'type' => 'Feature',
            'features' => array(
                'type' => 'Feature',
                'properties' => array(
                    'pickup_time' => "".$data['pickup_datetime']

                    ),
                "geometry" => array(
                    'type' => 'Point',
                    'coordinates' => array( 
                                    $data['pickup_longitude'],
                                    $data['pickup_latitude']
                    )
                )
            )
          );

    array_push($geojson['features'], $marker['features']);
    }

echo json_encode($geojson);