Hi is there any good scripts out there that can calculate miles based on 2 post codes?
e.g. i have a db where users can add there post code and i want to add a form where users can search in miles based on their post code?
e.g. search for other users based on how many miles away from their post code to other users postcodes, i have a drop down box where they can select how many miles away (5, 10, 25, 25, 35, 50, 100, 200+).
I’ve heard google API has something but not sure how to implement it…
When you capture the users postcode, store it and then find the lat,lng of the centre of that postcode.
Google “uk postcode lat long”.
Then when they want to find others near them you apply an algorithm in your sql statement which returns postcodes inside a given circle - something similar as shown in this post.
Googling “find nearest” might turn up others.
Google maps features examples which are usually termed “store finder” which may also help you.
Is there going to be a positive result?
Make sure there is some matching data first, use a lat, lng value from a known postcode (check it out gmaps) and be sure there are some values close to it and check them too.
Isolate the SQL from your PHP
Write that FULL statement out, enter values instead of variable names and enter it directly into your db manually, cut any possible PHP out of the equation totally.
If you get results, then your PHP is at fault, else ask on the place you got it from is all I can say.