Page 1 of 1

Display database error message

Posted: Fri May 04, 2012 9:06 am
by Ertenal
When i create a module, i sometimes write incorrect sql queries. After all, i'm only human :-). But the annoying part is that i won't get a sql error message when that happened. I have to check if the $dbresult variable (result of the Execute function) is false. This is very annoying and time consuming in the debug process.

Is there a way to turn the database error messages on? I have tried to search it here, but could not find an answer.

Re: Display database error message

Posted: Fri May 04, 2012 3:20 pm
by Wishbone
Have you tried activating debug mode in config.php? I know it shows the query, but am not sure if it shows the error.

Re: Display database error message

Posted: Fri May 04, 2012 3:22 pm
by calguy1000

Code: Select all

if( !$dbresult ) {
   debug_display($db->sql);
   debug_display($db->ErrorMsg());
}

Re: Display database error message

Posted: Thu May 10, 2012 7:34 pm
by Ertenal
@Wishbone I have tried debug mode; it still throws an error when dbresult = false.

@calguy1000 True, that will work. But since i query alot, i would have to put this code every where. I want to to give me an error message when an error occured, not when i check for errors.