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

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

 



 Jennifer is correct, the query that you have below will never return
anything. The last two AND statements exclude each other. You need to change
the greater than and less than signs on them and try it again. For now, don
t take what the developer is telling you as the gospel, go with what the
logic tells you. It is not possible to have a number that is both larger
then 37.6 AND smaller then 37.5, it just isn't going to happen.

Corrected SQL:

$sql=SELECT City FROM ZIPCodes WHERE
Latitude <= 122.02671343318
AND Latitude >= 121.96888656682
AND Longitude <= 37.617091284671
AND Longitude >= 37.508048715329;

Jim
 
-------Original Message-------
 
From: AdminHMO
Date: Tuesday, September 23, 2003 13:35:31
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
 
.

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

  Powered by Linux