I am betting the problem is simply your semicolon... never use a semicolon in a php 
mysql query. It
doesn't need one. In general, though, you should write your query such that it will 
tell you exactly
what went wrong... Re-write this like so:

$sql = 'select * from aannh_towns';
$result = mysql_query($sql) or exit("Query failed. Error: ".mysql_error()."<BR>".$sql);

This will spit out the mysql error as well as the query as mysql tried to execute it. 
You could even
make this a function if you like... then all you'd have to do is pass the query into 
it and it'll
spit out the result resource. Something like:

function sql_query($sql) {
    $result = mysql_query($sql) or exit("Query failed. Error: 
".mysql_error()."<BR>".$sql);
    return $result;
}

This will save you a lot of time searching for what broke! :-)

Cheers,

# Nathan

----- Original Message -----
From: "Dan McCullough" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Sunday, April 28, 2002 4:14 PM
Subject: [PHP] Supplied argument is not a valid MySQL result resource


What does that error mean?

$result = mysql_query('select * from aannh_towns;');
echo 'info stored';
while ($query_data = mysql_fetch_array($result)) {
 echo "", $query_data['town'], "", $query_data['town_id'], ""; }
?>

=====
dan mccullough
--------------------------------------------------------
"Theres no such thing as a problem unless the servers are on fire!"


__________________________________________________
Do You Yahoo!?
Yahoo! Health - your guide to health and wellness
http://health.yahoo.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to