I have to find all driver that are with in 20 kms based on passenger lat and log.

I have the following two table of driver and passenger.

passenger\_id    passenger\_name    passenger\_lat    passenger\_log

1                        David                       123.07                       55.03

2                        Sunil                       xyz.pq                        abc.7

And Driver table as

Driver\_id      Driver\_name              Driver\_lat                  Driver\_log

1                        Anil                       123.07                       55.03

2                        Jamis                       xyz.pq                        abc.7

Now I have input parameter of passenger\_lat and passenger\_log.based on that I have to return all Driver details that are with in 20 kms

```
 SELECT *, ( 6371 * acos( cos( radians({$lat}) ) * cos( radians( lat ) ) * cos( radians(   lng ) - radians({$lng}) ) + sin( radians({$lat}) ) * sin( radians( lat ) ) ) ) AS distance FROM positions HAVING distance <= {$radius} ORDER BY distance ASC 

```

plz provide the answer in php json and mysql