<?php
include('db_connect.php');

$response= array();
if(isset($_POST['android_id'])){
    $uid=$_POST['uid'];
    $latitude=$_POST['latitude'];
    $longitude=$_POST['longitude'];
    $android_id=$_POST['android_id'];
        $updateDate = isset($_POST['updateDate']) ? $_POST['updateDate'] : '';
    $updateToken="UPDATE `device_reg` SET `latitude`='$latitude',`longitude`='$longitude',`updateDate`='$updateDate' WHERE `android_id`='$android_id'";
mysqli_query($con,$updateToken);
$dataresult="Select * from device_reg where uid='$uid'";
$resultdata= mysqli_query($con,$dataresult);
$row=$resultdata->fetch_all(MYSQLI_ASSOC);

$response=array("error"=>"false","message"=>"record recived","data"=>$row);

// while($row= mysqli_fetch_assoc($resultdata)){
//     $response[]=$row;
//     }
}else{
    $response=array("error"=>"true","message"=>"Some error occured. Please try again!");

    // $response['error']= true;
    // $response['message']="Some error occured. Please try again!";
}

echo json_encode($response);
mysqli_close($con);

?>