PHP Classes

AzDGZIP: Lookup United States zip codes in a MySQL database

Recommend this page to a friend!
     
  Info   View files Files   Install with Composer Install with Composer   Download Download   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
StarStarStarStar 66%Total: 659 All time: 4,885 This week: 488Up
Version License PHP version Categories
azdgzip 1.0GNU Lesser Genera...3.0Databases, Geography
Description 

Author

This package is specific mainly for applications used in United States United States .

This class can be used to lookup United States zip codes in a MySQL database.

It can query the database to retrieve all the recorded zip codes that are within a radial distance from the location of a given zip code.

The class can also compute the distance between the locations of two given zip codes.

Picture of AzDG
Name: AzDG <contact>
Classes: 5 packages by
Country: Azerbaijan Azerbaijan
Age: 47
All time rank: 1941 in Azerbaijan Azerbaijan
Week rank: 164 Up1 in Azerbaijan Azerbaijan Equal

Details

############################################################ # \-\-\-\-\-\-\ AzDG - S C R I P T S /-/-/-/-/-/-/ # ############################################################ # Written by AzDG (support@azdg.com) # # Created 23/04/07 Last Modified 23/04/07 # # Scripts Home: http://www.azdg.com # ############################################################ # File name ZIPLocator.php # # File purpose Class for ZIP distance count # # File created by AzDG <support@azdg.com> # ############################################################ # Idea from http://www.sanisoft.com "zipLocator" algorithm # License LGPL ############################################################ First of all THANKS for best and fastest algorithm to: Tarique Sani <tarique@sanisoft.com> Girish Nair <girish@sanisoft.com> phpZipLocator Home <http://www.sanisoft.com/ziploc/ > This is the fastest zip codes distance detecting algorithm we was found in the web. Idea is perfect. We just changed full code and several mysql table properties: - excluded mysql db class (now is working with mysql queries) - improved security (cb() function which check incoming data) - reorganized the table contained zip codes (now it is static( based on char fields) and by this reason is faster, and also we added required unique index for zipcode field and it is improve speed too) - rewritten code (some variables, quotes) for better performance Installation: ------------------------- 1. First of all install zip data from zip_codes.zip archive - download them from http://www.azdg.com/download/download.php?fid=10 2. Edit your MySQL details in the test_zip.php: @mysql_connect('localhost', 'user', 'password') or die("Can`t connect to server<br>Your mysql login or mysql password is wrong."); @mysql_select_db('database') or die("Can`t connect to server<br>Database doesn`t exist"); Results: ------------------------- Thats all - run test_zip.php from browser. You should to get something like: The distance between 12345 and 23456 is 433.16 Miles There are 107 Zip codes within 20 Miles of 12345: Example Query to find all users within 20 miles: mysql_query("Select * FROM YourTableName Where YourZipField IN (12008, 12009, 12010, 12016, 12019, 12020, 12023, 12025, 12027, 12035, 12041, 12053, 12054, 12055, 12056, 12059, 12065, 12066, 12068, 12069, 12070, 12072, 12074, 12084, 12085, 12086, 12092, 12107, 12110, 12111, 12118, 12128, 12137, 12141, 12148, 12150, 12151, 12157, 12159, 12160, 12166, 12177, 12183, 12186, 12188, 12189, 12201, 12203, 12204, 12205, 12206, 12207, 12208, 12209, 12210, 12211, 12212, 12214, 12220, 12222, 12223, 12224, 12225, 12226, 12227, 12228, 12229, 12230, 12231, 12232, 12233, 12234, 12235, 12236, 12237, 12238, 12239, 12240, 12241, 12242, 12243, 12244, 12245, 12247, 12248, 12249, 12250, 12252, 12255, 12256, 12257, 12260, 12261, 12262, 12288, 12301, 12302, 12303, 12304, 12305, 12306, 12307, 12308, 12309, 12325, 12345, 12863)")

  Files folder image Files (3)  
File Role Description
Accessible without login Plain text file readme.txt Doc. Readme file
Plain text file test_zip.php Example Example script
Accessible without login Plain text file ZIPLocator.php Class Class

The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page.
Install with Composer Install with Composer
 Version Control Unique User Downloads Download Rankings  
 0%
Total:659
This week:0
All time:4,885
This week:488Up
User Ratings User Comments (1)
 All time
Utility:83%StarStarStarStarStar
Consistency:83%StarStarStarStarStar
Documentation:83%StarStarStarStarStar
Examples:83%StarStarStarStarStar
Tests:-
Videos:-
Overall:66%StarStarStarStar
Rank:489
 
Outstanding!
15 years ago (F Philip DeGeorge)
80%StarStarStarStarStar