Page 1 of 1

Get Database debugging information

Posted: Mon Feb 11, 2008 12:04 am
by FantomCircuit
I was wondering if there is a way I can get the latest mysql error from the $db object, or if there is a value somewhere that I can check if there has been a database error.

At the moment I can either check the debug output or simply use the mysql_error() function, but sometimes I can't turn debugging on for various reasons and obviously using mysql_error isn't that great for portability (ie: if we switch to postgres down the track).

There is an array variable in the $db object called 'query_list_errors' but it is always empty even if I introduce deliberate sql syntax errors. Is there some built in function or variable that I can use?

Re: Get Database debugging information

Posted: Mon Feb 11, 2008 12:07 am
by calguy1000
$db->ErrorMsg();  that's the simple wrapper around the mysql_error() function.

It's in the adodb stuff.

Re: Get Database debugging information

Posted: Mon Feb 11, 2008 12:12 am
by FantomCircuit
Awesome, thanks for the fast reply calguy. Works exactly as you said :)