It returns distance in miles. So to specify a distance, simply include the distance in the where clause:
And ROUND((ACOS((SIN(#passedzip.lat#/57.2958) * SIN(lat/57.2958)) + (COS(#passedzip.lat#/57.2958) * COS(lat/57.2958) * COS(long/57.2958 - #passedzip.long#/57.2958)))) * 3963, 1) < #distanceInMiles# -----Original Message----- From: Phillip B [mailto:[EMAIL PROTECTED] Sent: Monday, August 25, 2003 3:06 PM To: SQL Subject: zipcode search problem I read the zip code radius article here http://tutorial153.easycfm.com/ . I can now query the database and get records back but not within the specified miles. I'm sure it has something to do with this part of the statement. (#form.passedradius#/111) Any ideas of what I need to change? SELECT zip, lat, long, state, city, ROUND((ACOS((SIN(#passedzip.lat#/57.2958) * SIN(lat/57.2958)) + (COS(#passedzip.lat#/57.2958) * COS(lat/57.2958) * COS(long/57.2958 - #passedzip.long#/57.2958)))) * 3963, 1) AS distance FROM zips WHERE (lat >= #passedzip.lat# - (#form.passedradius#/111)) And (lat <= #passedzip.lat# + (#form.passedradius#/111)) AND (long >= #passedzip.long# - (#form.passedradius#/111)) AND (long <= #passedzip.long# + (#form.passedradius#/111)) ORDER BY distance Phillip B. www.LoungeRoyale.com www.FillWorks.com ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Archives: http://www.houseoffusion.com/lists.cfm?link=t:6 Subscription: http://www.houseoffusion.com/lists.cfm?link=s:6 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=<:emailid:>.<:userid:>.<:listid:> This list and all House of Fusion resources hosted by CFHosting.com. The place for dependable ColdFusion Hosting. http://www.cfhosting.com
