Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

No reason for: mysql_fetch_array(): supplied resource is not a valid M

Status
Not open for further replies.

webdev007

Programmer
Sep 9, 2005
168
This really is bugging me
as you see even in debugging mode I do ne get any mysql error
If I echo the query I obtain the expected result
further even if below the script excerpt if I echo the values I again get the expected result
so where is the error for something so basic
what am I overlooking at?
the error is on the last line (while...)
and tels me "supplied ressorce is not a valid...
thanks

$query = "SELECT city, name, rating
FROM
rating_AAAA
WHERE
city='$city' ";//echo"1Q: $query<p>";
//$result = mysql_query($query) or die(mysql_error());
$result = mysql_query($query);
if(! $result || mysql_error() || mysql_num_rows($result) < 1)
{
echo sprintf('%s rows, [%s] , error: %s',
mysql_num_rows($result),
$query,
mysql_error());
exit;
}
while($row=mysql_fetch_array($result))
 
Sorry!
Case solved
in my connection script I wrongly declared a global
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top