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

From: Date: Tue, 23 Sep 2003 18:59:00 +0000
Subject: Re: mysql field not resolving comaparison condition for zip code locator
References: 1 2  Groups: php.db 
Request: Send a blank email to php-db+get-30648@lists.php.net to get a copy of this message
Thanks for the suggestion but the quotes didn't make a difference I submitted the sql though php myadmin that takes care of the quote syntax "Peter Beckman" <beckman@purplecow.com> wrote in message news:20030923143903.K1144@thermonuclear.org... > > 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/ > -------------------------------------------------------------------------- -

« previous php.db (#30648) next »