How to show / debug PEAR::DB errors in webpage?
Posted
by Markus Ossi
on Stack Overflow
See other posts from Stack Overflow
or by Markus Ossi
Published on 2010-05-31T13:29:28Z
Indexed on
2010/05/31
13:33 UTC
Read the original article
Hit count: 249
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()
© Stack Overflow or respective owner