newbie: Supplied argument is not a valid MySQL result..?
| From: | Lee Philip Reilly | Date: | Mon, 03 Dec 2001 21:59:58 +0000 |
| Subject: | newbie: Supplied argument is not a valid MySQL result..? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-76419@lists.php.net to get a copy of this message | ||
Hi,
I wonder if someone could point out what is wrong with the following
piece of code (taken directly from the 'PHP - fast & easy web
development' book) , which gives the following warning :
Warning: Supplied argument is not a valid MySQL result resource in
c:\program files\apache group\apache\htdocs\cms\pick_modcontact.php on
line 23
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
$result = mysql_query($sql,$connection); <--line 23
while ($row = mysql_fetch_array($result)) {
$id = $row['id'];
$fname = $row['fname'];
$lname = $row['lname'];
$option_block .= "<option value=\"$id\">$lname, $fname</option>";
}
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
The mySQL query that is executed returns a result set when I use the
mySQL shell, and the connection string is valid. If someone could advise
me as to the error, I would greatly appreciate it.
- Best regards,
Lee