PHP Classes

File: readme.txt

Recommend this page to a friend!
  Classes of AzDG   AzDGZIP   readme.txt   Download  
File: readme.txt
Role: Documentation
Content type: text/plain
Description: Readme file
Class: AzDGZIP
Lookup United States zip codes in a MySQL database
Author: By
Last change: Added link for download zip_codes archive
Date: 17 years ago
Size: 3,116 bytes
 

Contents

Class file image Download
############################################################ # \-\-\-\-\-\-\ 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)")