hansman Posted August 18, 2008 Share Posted August 18, 2008 Hello, I searched google and the forums, but i cannt seem to find a way to use php with zip codes in my database to use zip codes near by. For example if i had a store located in the "12345" zip code, and some once searched "12349" and that was the town next to it, it would pop up. How can i go upon doing this. Also, is there a SQL text document somewhere that has a list of every US zip code with city and state? Quote Link to comment https://forums.phpfreaks.com/topic/120253-zip-codes/ Share on other sites More sharing options...
DeanWhitehouse Posted August 18, 2008 Share Posted August 18, 2008 i think you would need to use a mysql query with LIKE Quote Link to comment https://forums.phpfreaks.com/topic/120253-zip-codes/#findComment-619470 Share on other sites More sharing options...
revraz Posted August 18, 2008 Share Posted August 18, 2008 There really is no way for the DB to know that 12345 is next to 12349 unless you had some other field that included GPS Long/Lat or a table that listed adjacent zips. Quote Link to comment https://forums.phpfreaks.com/topic/120253-zip-codes/#findComment-619472 Share on other sites More sharing options...
DeanWhitehouse Posted August 18, 2008 Share Posted August 18, 2008 But LIKE , will bring it up as it contains the same first 4 numbers. Quote Link to comment https://forums.phpfreaks.com/topic/120253-zip-codes/#findComment-619475 Share on other sites More sharing options...
hansman Posted August 18, 2008 Author Share Posted August 18, 2008 zip codes are near each other with the first 4 numbers? do you know of any free GPS long lat scripts? Quote Link to comment https://forums.phpfreaks.com/topic/120253-zip-codes/#findComment-619477 Share on other sites More sharing options...
revraz Posted August 18, 2008 Share Posted August 18, 2008 And because they are the same first 4 means they are next to each other? Take a look at a zip code map, I doubt you will find that to be the case at all. But LIKE , will bring it up as it contains the same first 4 numbers. Quote Link to comment https://forums.phpfreaks.com/topic/120253-zip-codes/#findComment-619479 Share on other sites More sharing options...
DeanWhitehouse Posted August 18, 2008 Share Posted August 18, 2008 Im in UK so it's different Quote Link to comment https://forums.phpfreaks.com/topic/120253-zip-codes/#findComment-619480 Share on other sites More sharing options...
hansman Posted August 18, 2008 Author Share Posted August 18, 2008 I am just looking for an easy way for people to find companies in their areas using zip codes, should i not use zip codes? Also, does any one have a sql file with every city state zip in the country(USA) Quote Link to comment https://forums.phpfreaks.com/topic/120253-zip-codes/#findComment-619486 Share on other sites More sharing options...
revraz Posted August 18, 2008 Share Posted August 18, 2008 That type of DB would need to be updated pretty often. You'll probably have to pay a 3rd party to supply that or search USPS website. Quote Link to comment https://forums.phpfreaks.com/topic/120253-zip-codes/#findComment-619490 Share on other sites More sharing options...
hansman Posted August 18, 2008 Author Share Posted August 18, 2008 take for example http://www.propursuit.com/pestcontrol/ it looks like this guy broke up the zip codes into zones, how could i do that? Quote Link to comment https://forums.phpfreaks.com/topic/120253-zip-codes/#findComment-619491 Share on other sites More sharing options...
revraz Posted August 18, 2008 Share Posted August 18, 2008 He probably has a DB where the advertisers/companies give him a list of what zip codes they service. But here is the first link I noticed doing a google search for zip code database http://www.zipcodedownload.com/Products/Product/Z5Commercial/Standard/Overview/?cid=ZC:3ZCD-commercial Quote Link to comment https://forums.phpfreaks.com/topic/120253-zip-codes/#findComment-619494 Share on other sites More sharing options...
hansman Posted August 18, 2008 Author Share Posted August 18, 2008 ok, I think i will be purchasing this, what would be the best way to have someone search their zip code and show company's in nearby zips? Quote Link to comment https://forums.phpfreaks.com/topic/120253-zip-codes/#findComment-619535 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.