Jump to content

selecting results by postcode / longitude / latitude


Recommended Posts

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?

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.