Location: PHPKode > scripts > Zip Code Range > zip-code-range/Usage.txt
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 http://www.cfdynamics.com/cfdynamics/zipbase/index.cfm 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>';

Return current item: Zip Code Range