error checking for databases - Fatal error: Call to undefined function
| From: | jeff at altahost dot com | Date: | Sun, 04 Aug 2002 23:51:50 +0000 |
| Subject: | error checking for databases - Fatal error: Call to undefined function | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-2048@lists.php.net to get a copy of this message | ||
Trying to get pear error functions to work. I tried to re-create an error by
using a bogus SQL and setting a query on a table that does not exist. The
code listed at the botom of this email generates this error message:
Fatal error: Call to undefined function: fetchrow()
When the SQL is written for a valid table the code works fine. Why does it
generate **this** error message when the SQL has an error?
Thanks;
Jeff
require_once( 'DB.php' );
$db = DB::connect( "mysql://$user:$password@$host/$database" );
$sql = 'SELECT * FROM BogusTable';
$demoResult = $db->query($sql);
while ($demoRow = $demoResult->fetchRow())
{
echo $demoRow[0] . '<br>';
}
if (DB::isError($demoResult))
{
die ($demoResult->getMessage());
}
$db->disconnect();