Jump to content

Zip Codes


hansman

Recommended Posts

I have a Table filled with zip codes.

I have another table that i wish to put companies in. In this table there is a field for zip codes. I would like to place several zip codes in this box.

 

I then would like the company profile to come up when i search for one of the zip codes.

 

How can i go upon doing this?

 

Can anyone help?

Link to comment
Share on other sites

there are very good triagulation tutorials out there on how to use zip codes.  I'll briefly go through the process

 

1) Get a table called zip_codes it has every zip code, its longitudinal position an latitude position (google it its free)

2) User enters a valid 5 digit zip code and submits a form for a query

3) Run a query to get that zip code's lat/long position

4) Set up your proximity distance and use the conversion 1 arcdegree = 69 miles

5) Requery the zipcode table for all zip codes that have a long/lat thats values satisfy the original zip code +/- the variance (figure in step 4)

6) Use the zip codes in step 5 to query for results in the primary company table.

 

 

This can almost be done in 1 query.  Step 5/6 can be chunked down to 1 query using in the where clause

comapny.zipcode in (Select zipcode from `zips` where lat >= lat-off and lat <= lat+off and long >= long-off and long <= long+off)

 

Google it if this makes no sense to you

Link to comment
Share on other sites

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.