RE: mysql field not resolving comaparison condition for zip code locator

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Here's what I think you are going for:  (example is from my DB so table and
field names are different.

mysql> SELECT * FROM ZipCodes WHERE Lon <= 122.02671343318 AND
    -> Lon >= 121.96888656682
    -> AND Lat <= 37.617091284671 AND
    -> Lat >= 37.508048715329;
+---------+-------+-------+-----+-------+---------+-----+------+---------+--
--------+------+
| City    | State | Zip   | AC  | FIPS  | County  | TZ  | DST  | Lat     |
Lon      | Type |
+---------+-------+-------+-----+-------+---------+-----+------+---------+--
--------+------+
| Fremont | CA    | 94536 | 127 | 06001 | Alameda | PST | Y    | 37.5710 |
121.9858 |      |
| Fremont | CA    | 94537 | 127 | 06001 | Alameda | PST | Y    | 37.5486 |
121.9875 | P    |
+---------+-------+-------+-----+-------+---------+-----+------+---------+--
--------+------+
2 rows in set (0.00 sec)

> -----Original Message-----
> From: AdminHMO [mailto:bsass1@pacbell.net]
> Sent: Tuesday, September 23, 2003 1:32 PM
> To: php-db@lists.php.net
> Subject: Re:  mysql field not resolving comaparison condition
> for zip code locator
>
>
> Thanks Jennifer,
>
> I got the query and the zipcode longitude and latitude from the
> developer of
> the zipcode locator. When I contacted them about this issue they
> had me run
> this query in the phpMyAdmin against the zipcode date and I still got no
> data returned.
>
> "Jennifer Goodie" <goodie@apollointeractive.com> wrote in message
> NEBBIJJIKBGCCCNKMPBCOEPGJJAA.goodie@apollointeractive.com">news:NEBBIJJIKBGCCCNKMPBCOEPGJJAA.goodie@apollointeractive.com...
> > >
> > > I am having trouble implementing a zip code locator program.
> All of the
> > > functions work correctly but the $sql variable.
> > > The problem occurs by using the latitude argument as a
> > > comparison. The first
> > > latitude argument works but when the second
> > > latitude argument is added the query returns no data. Here is an
> > > example of
> > > the $sql variable being used.
> > >
> > > $sql=SELECT City FROM ZIPCodes WHERE
> > >    Latitude <= 122.02671343318
> > >               AND Latitude >= 121.96888656682
> > >    AND Longitude >= 37.617091284671
> > >    AND Longitude <= 37.508048715329;
> > >
> >
> > I think Latitude only goes to 90, so they are all under 122 and none are
> > above 121.  Also, you aren't going to get something that is greater than
> > 37.6 but less than 37.5
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux