NYCPHP Meetup

[nycphp-talk] Re: talk Digest, Vol 3, Issue 50

Urb LeJeune urb at e-government.com
Mon Jan 22 16:57:47 EST 2007


>Partially.  Once I find all the zip codes within an x-mile radius I 
>have to find all records in a db table that match any of those zip codes.

Load an array of zip codes within an x-mail radius, Let's assume 
$ZipArray. Next.

$Subselect = "(" . implode('",",$ZipArray)  , '")';

Let's additionally assume you have table "Members" with a field ZipCode

Then  do

$Select = "SELECT * FROM Members WHERE ZipCode IN $Subselect";

which would expand to something like:

SELECT * FROM Members WHERE ZipCode IN ("08087","08088","08089")

Urb





More information about the talk mailing list