Re: warning
| From: | Phil Driscoll | Date: | Tue, 17 Oct 2000 13:25:28 +0000 |
| Subject: | Re: warning | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-20618@lists.php.net to get a copy of this message | ||
This is the old favourite caused by you not checking that the mysql_query
returned a valid result.
You need to handle the case where the mysql_query call returns 0
something along the lines of:
$results = mysql_query($sql);
if($results)
{
$array = mysql_fetch_rows($results);
}
else
{
echo('error: mysql query went wrong');
...deal with it/get extra error information etc
}
If you can't carry on if the query fails you can use 'OR die' to bomb out:
e.g.
$results = mysql_query($sql) OR die('error: mysql query went wrong');
Cheers
--
Phil Driscoll
Dial Solutions
+44 (0)113 294 5112
http://www.dialsolutions.com
http://www.dtonline.org