i have 3 tables: 1 contains people with their city (comes from other table) and the range (int, 1-20) they want to be found in (in miles) 1 contains cities and the beginning of the postcode (i.e. BB2) 1 contains cities and their logitudes/latitudes
what i am trying to do is select the people according to a postcode someone enters. if this postcode is for a city within their range then the person should be selected from the DB.
i have this php code:
// Latitude calculation
$limit = (1 / 69.1703234283616) * $radius;
$latitude_min = $latitude - $limit;
$latitude_max = $latitude + $limit;
// Longitude calculation
$limit = (1 / (69.1703234283616 * cos($userLat * (pi/180)))) * $radius;
$longitude_min = $longitude - $limit;
$longitude_max = $longitude + $limit;
now heres the hard part. i dont know how i am going to select the people from the DB, depending on what postcode was entered and their range.
can someone help me out a little here?