How to show / debug PEAR::DB errors in webpage?
- by Markus Ossi
I am connecting to MySQL database on my webpage and have this copy-pasted code for errors:
if(DB::isError($db)) die($db->getMessage());
I have the connection code in an outside file called connection.inc that I include at the beginning of my page before the DOCTYPE and html tags.
For debugging purposes, how can I print the database errors on my webpage?
I thought I could do something like this:
echo 'Could not connect to database. The error was:' . $db->getMessage();
but this returns: Fatal error: Call to undefined method DB_mysql::getMessage()