Jump to content

Distance Query


wemustdesign

Recommended Posts

Hi,

 

I am using this query to list the closest distances to a certain lat/ lon

 

$qry = "SELECT *,(((acos(sin(($lat*pi()/180)) * sin((`lat`*pi()/180))+cos(($lat*pi()/180)) * cos((`lat`*pi()/180)) * cos((($lon- `lon`)*pi()/180))))*180/pi())*60*1.1515) AS distance FROM `location` WHERE distance <= 10";

 

I am getting an error:

 

Unknown column 'distance' in 'where clause'

 

Can anybody see what the error is?

Link to comment
https://forums.phpfreaks.com/topic/242638-distance-query/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.