FAQ Database Discussion Community


get all the users within X KM range from a user

javascript,haversine
I have an array of users and their gps coordinates. what formula can I use to get all the users that are within X KM range from a user? I need to avoid heavy calculations. I was thinking about sorting the array, but I realized that it isn't a good...

PHP Query issue in setting values?

php,mysql,sql,mamp,haversine
Quick question. I've got a SQL query which works with my database. However, I am to sure how to set parameters in my PHP file so that it works with my query? Any Ideas? I'm having trouble with the Set parameters in terms of php and making my query work....

Which unit is `distance` returning in this SQL query

mysql,haversine
I'm messing with some latitude/longitude related code in the Google Maps API which provides me with the following SQL statement SELECT id, ( 3959 * acos( cos( radians(37) ) * cos( radians( lat ) ) * cos( radians( lng ) - radians(-122) ) + sin( radians(37) ) * sin( radians(...

Codeigniter and SQL/Haversine Formula

php,sql,codeigniter,haversine
I am using Codeigniter for a project and have some locations with latitude and longitude inputs on the database. I'm trying to get points within a certain distance (50km), and attempting it with the Haversine Formula. However, on my controller and view it doesn't print out the results. What I...

Grouping and counting of records in Haversine Formula SQL Query

php,mysql,sql,sql-server,haversine
I am working on a vehicle trading website. I have table named vehicle with around 20 fields including make, model etc of the vehicle. I am writing a search query to retrieve all the cars in the system group by make along with their counts by make. So my objective...