Login   Register  
PHP Classes
elePHPant
Icontem

File: Usage.txt

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Allan Bogh  >  Zip Code Range  >  Usage.txt  >  Download  
File: Usage.txt
Role: Documentation
Content type: text/plain
Description: Text file which explains the proper usage.
Class: Zip Code Range
Get zip codes within a range from a given zip code
Author: By
Last change:
Date: 2006-05-30 11:55
Size: 1,059 bytes
 

Contents

Class file image Download
Proper usage for the updated ZipCodesRange class is as follows...

Requirements:
- mySQL, PHP
- a mySQL database connection must already be established.
- a database with a zip code column, longitude column, and latitude column must be made. Other information is optional.
- Zip code databases can be found here http://www.cfdynamics.com/cfdynamics/zipbase/index.cfm and other places.

Usage:

<?php 

//initialization, pass in DB connection, from zip code, distance in miles.
$zip = new ZipCodesRange($appconf['dbconnection'],'98303',50);

//configuration
$zip->setTableName('zip_codes'); //optional, default is zips.
$zip->setZipColumn('zip'); //optional, default is zip.
$zip->setLonColumn('longitude'); //optional, default is lon.
$zip->setLatColumn('latitude'); //optional, default is lat.

//do the work
$zip->setZipCodesInRange(); //call to initialize zip array

//zip code output, other processing can be done from this array.
$zipArray = $zip->getZipCodesInRange();

echo '<pre>';
print_r($zipArray);
echo '</pre>';

?>