android - Getting latitude and longitude from server using PHP -
i trying build android app queries server latitude , longitude given destination. there seems error in php code shows following error when input address in web browser.
notice: undefined variable: destination in c:\xampp\htdocs\serverfiles\btc.php on line 6 {"result":[{"latitude":null,"longitude":null}]} this btc.php file:
<?php if($_server['request_method']=='get'){ $id = $_get['destination']; $con = mysqli_connect("127.0.0.1", "root", "", "bustrack"); $sql = "select * updates destination='".$destination."'"; $r = mysqli_query($con,$sql); $res = mysqli_fetch_array($r); $result = array(); array_push($result,array( "latitude"=>$res['latitude'], "longitude"=>$res['longitude'], ) ); echo json_encode(array("result"=>$result)); }
$sql = "select * updates destination='".$destination."'"; variable $destination not exist. need declare before using it. believe variable $id want, looking code.
Comments
Post a Comment