0

What could make a query run fine from the command line and return the expected results, but not return results when run through the page? I get no syntax errors, just a warning for the fetch_array. It all looks good to me, I'm stumped.

I echoed all the variables immediately before the query and they hold the same values that I use from the command line and get results. I also echoed the query itself just to be sure and everything is there.

Here is the query.

$flat=("SELECT C.Latitude, C.Longitude FROM Cities C JOIN Countries Co ON Co.CountryId = C.CountryId JOIN Regions R ON R.RegionId = C.RegionId WHERE C.City = '$city' and Co.Country = '$country' and R.Region='$state'");
	while($fr = mysql_fetch_array($flat)){
		$lat = $fr['Latitude'];
		$long = $fr['Longitude']; }
2
Contributors
4
Replies
5
Views
7 Years
Discussion Span
Last Post by CFROG
1
<?php
/* connect select db etc */
$flat=("SELECT C.Latitude, C.Longitude FROM Cities C JOIN Countries Co ON Co.CountryId = C.CountryId JOIN Regions R ON R.RegionId = C.RegionId WHERE C.City = '$city' and Co.Country = '$country' and R.Region='$state'");
while ($fr = mysql_fetch_array(mysql_query($flat))) {
$lat = $fr['Latitude'];
$long = $fr['Longitude']; } 
/* echo $lat $long; */
?>

I dunno but there has to be a query in there doesnt there?

0

DOH! Okay, let's both just walk away from that one and pretend like it never happened.

0

DOH! Okay, let's both just walk away from that one and pretend like it never happened.

I ran it through a syntax checking editor
Syntactically the first one is correct code
each line was right in itself
It took asking my 18 year old for a hint,
he just said
"whats the query?"
and left :(

Edited by almostbob: n/a

0

Yup, I gave myself a V8 over that one. Here's your sign 8-)

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.