I have a problem with my PHP code that will look for an entire SQL table, and then display it in JSON format.
Here, the PHP code :
<?php
*CONFIG MYSQL*
$lat=$_GET["lat"];
$lng=$_GET["lng"];
$dblink = new mysqli($dbhost, $dbuser, $dbpass, $dbname);
$command = "SELECT *, 111.045 * DEGREES(ACOS(COS(RADIANS($lat))
* COS(RADIANS(app_lieux.lat))
* COS(RADIANS(app_lieux.lng) - RADIANS($lng))
+ SIN(RADIANS($lat))
* SIN(RADIANS(app_lieux.lat))))
AS distance_in_km
FROM app_lieux
ORDER BY distance_in_km ASC
LIMIT 0,5";
$result = $dblink->query($command);
$dbdata = array();
while ( $row = $result->fetch_assoc()) {
$dbdata[]=$row;
}
echo json_encode($dbdata);
?>
When i try to go to the script, i have a blank page without error. http://notaire-gilles-france.be/charleroi2/lieux.php?lat=50.44348&lng=4.43840
What's the problem? Thank you very much for your help !