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.

有帮助吗?

解决方案

$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"];
}
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top