PHP Classes

File: Usage.txt

Recommend this page to a friend!
  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: 10 years ago
Size: 1,059 bytes


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

- 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 and other places.



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

$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>';
echo '</pre>';