Google Answers Logo
View Question
Q: Implementing a "search by zip code" function on our website ( No Answer,   5 Comments )
Subject: Implementing a "search by zip code" function on our website
Category: Computers > Programming
Asked by: gravitron-ga
List Price: $5.00
Posted: 29 Sep 2006 16:04 PDT
Expires: 29 Oct 2006 15:04 PST
Question ID: 769576
We run a manufacturing/wholesale business out of Austin, TX.  We
currently sell to around 300 retail shops in the USA, and that number
continues to grow. On our website we would like to implement a 'search
by zip code' option so that people can find the stores nearest them
which carry our product.  This is a function that seems to be all over
the internet, but is usually only found on the site's of much larger
companies. What are some good ways to accomplish this goal in an
effective and hopefully inexpensive manner?

Request for Question Clarification by tlspiegel-ga on 29 Sep 2006 19:39 PDT
Hi graviton,

I found a script at the following site, however I haven't had time to
install it to see if it works.  Perhaps this will work for you.  If
so, please post a clarification and I'll answer your question.

Best regards,

Clarification of Question by gravitron-ga on 06 Oct 2006 09:30 PDT
That script didn't seem to work for us. We actually need something
that will give people the stores closest to their zip code, as in many
cases there is no store in a particular zip code. Is there affordable
software available that would simply link to our database of shops?
There is no answer at this time.

Subject: Re: Implementing a "search by zip code" function on our website
From: denstan-ga on 03 Oct 2006 12:20 PDT
Hi gravitron-ga

If you have your store data in a database, you can add a table that
would contain ZIP codes along side long/lat numbers
( In your query you would
select the difference between "search" and store long/lat and show
only the ones that fit your criteria.

Alternatively there are some web services that do that (you'll have to
google those).

Subject: Re: Implementing a "search by zip code" function on our website
From: kelvingeorge-ga on 04 Oct 2006 15:48 PDT
Store the zip code of the store in the store information table.
And write a function to search. And link them with products table. if
available in any perticular store
Subject: Re: Implementing a "search by zip code" function on our website
From: poprhythm-ga on 15 Oct 2006 14:36 PDT
Hi gravitron,

Zip code latitudes and longitudes are gathered by the US census and
are considered public domain.  As such, there are several projects
which can provide you with just what you need - particularly, this
site has it all nicely formatted:

After you've got a zip code to query, you'll want to compare it with
all of your locations to find a minimum distance(s).  Using the two
latitude/longitude coordinates, get the distance in miles using a
function like this:

Here is another implementation of this function, including SQL procedure:

So, this can all be accomplished at the database level, which is what I recommend.

Subject: Re: Implementing a "search by zip code" function on our website
From: husameddin-ga on 17 Oct 2006 04:16 PDT
Hello gravitron
Try PHP Google Store Locator is a PHP/MySQL application that allows
people to find stores that are close to their zipcode. It can be used
for things other than just finding stores such as showing where all
your mansions are and how to get to them?it is an Open Source software

You can try the demo here 

And download the script from here

And the US-Zipcodes-MySQL

Subject: Re: Implementing a "search by zip code" function on our website
From: utsav_verma-ga on 25 Oct 2006 22:07 PDT

Its a lame logic, i am not aware of US Zip code patter but i think
should be following  state-city-area pattern. If so, through string
manipulation you can dive the entered zip code and can serach on the
basis of parts of zip code.

Important Disclaimer: Answers and comments provided on Google Answers are general information, and are not intended to substitute for informed professional medical, psychiatric, psychological, tax, legal, investment, accounting, or other professional advice. Google does not endorse, and expressly disclaims liability for any product, manufacturer, distributor, service or service provider mentioned or any opinion expressed in answers or comments. Please read carefully the Google Answers Terms of Service.

If you feel that you have found inappropriate content, please let us know by emailing us at with the question ID listed above. Thank you.
Search Google Answers for
Google Answers  

Google Home - Answers FAQ - Terms of Service - Privacy Policy