Get Database debugging information

Talk about writing modules and plugins for CMS Made Simple, or about specific core functionality. This board is for PHP programmers that are contributing to CMSMS not for site developers
Post Reply
User avatar
FantomCircuit
Forum Members
Forum Members
Posts: 75
Joined: Fri Nov 10, 2006 1:34 am
Location: Gold Coast, Australia

Get Database debugging information

Post 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?
calguy1000
Support Guru
Support Guru
Posts: 8169
Joined: Tue Oct 19, 2004 6:44 pm
Location: Fernie British Columbia, Canada

Re: Get Database debugging information

Post by calguy1000 »

$db->ErrorMsg();  that's the simple wrapper around the mysql_error() function.

It's in the adodb stuff.
Follow me on twitter
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
User avatar
FantomCircuit
Forum Members
Forum Members
Posts: 75
Joined: Fri Nov 10, 2006 1:34 am
Location: Gold Coast, Australia

Re: Get Database debugging information

Post by FantomCircuit »

Awesome, thanks for the fast reply calguy. Works exactly as you said :)
Post Reply

Return to “Developers Discussion”