Question

i have a list of zip codes that belongs to the state of NY, i would like to filter them to only show the zip codes belonging to the city of New York. does anyone know what are the zip codes for the city of new york, and/or if there's a programmatic way of finding out if a given zip code belongs to New York city? pref in php. the codes are stored in a mysql database.

Was it helpful?

Solution

$db = new mysqli('localhost', 'NAME', 'PASSWORD', 'DATABASENAME');
if($db->connect_errno > 0){
    die('Unable to connect to database [' . $db->connect_error . ']');
}
$query = "SELECT something FROM zipcodes WHERE zipcode BETWEEN 10000 AND 10163";
$result = mysqli_query($db, $query);
while ($row = mysqli_fetch_assoc($result))
{
      echo "Something =".$row["something"];
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top