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

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

 



On Tue, 23 Sep 2003, AdminHMO wrote:

> I am having trouble implementing a zip code locator program. All of the
> functions work correctly but the $sql variable.

Try putting the SQL in quotes:

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

> 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;
>
> This is the format recommended by the zip code locator develper for the sql
> argument. There must be some logical way
> to present this to the mysql database that will perform the latitude and
> longitude comparison and retun the proper results.
> A suggestion was making sure that the field is a numberic string type. I
> used "Float", "Decmial", "Double" and "CHAR" the result was the same. Please
> help!

---------------------------------------------------------------------------
Peter Beckman                                                  Internet Guy
beckman@purplecow.com                             http://www.purplecow.com/
---------------------------------------------------------------------------

-- 
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