![]() |
How to prevent CI from dumping SQL on screen when err occurs? - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: How to prevent CI from dumping SQL on screen when err occurs? (/showthread.php?tid=4170) Pages:
1
2
|
How to prevent CI from dumping SQL on screen when err occurs? - El Forum - 11-10-2007 [eluser]starenka[/eluser] How to prevent CI from dumping SQL on screen when error occurs? These messages are pretty fancy while developing, but it's a hazard show such data on production servers.. anybody can put me into it? thanx How to prevent CI from dumping SQL on screen when err occurs? - El Forum - 11-10-2007 [eluser]starenka[/eluser] Or how can i change such messages? Im used to handle errors myself like: Code: if(!query) show_error(....) but CI, stops the script execution on db error and puts up it's own message.... How to prevent CI from dumping SQL on screen when err occurs? - El Forum - 11-10-2007 [eluser]gtech[/eluser] Hello, You can stop the database class from halting execution by setting db_debug to FALSE in the database.php file contained in the config directory. This will also speed you database queries up ![]() I have caught errors using the following mechanism once db_debug is off: Code: ... How to prevent CI from dumping SQL on screen when err occurs? - El Forum - 11-10-2007 [eluser]starenka[/eluser] kool. thx How to prevent CI from dumping SQL on screen when err occurs? - El Forum - 11-10-2007 [eluser]gtech[/eluser] no problems, its a shame the db->_error_ number & db->_error_message functions are not documented in the main documentation, it would also be good if these functions were not internal (preceding underscores), but it still works as above. How to prevent CI from dumping SQL on screen when err occurs? - El Forum - 11-11-2007 [eluser]iive[/eluser] agreed. I think it is good for us to customize the how the error message should be displayed on screen to maintain the site apprearance across all the pages. How to prevent CI from dumping SQL on screen when err occurs? - El Forum - 11-11-2007 [eluser]Phil Sturgeon[/eluser] They arent documented as they are only really intended for internal use by that class. If this was a PHP5 app you probably wouldnt able to get at them at all! Good old PHP4... How to prevent CI from dumping SQL on screen when err occurs? - El Forum - 11-11-2007 [eluser]gtech[/eluser] I know they are intended for internal use.. but its would be very easy to write an external function that just calls the internal function... I am writing a middleware management application that talks to hardware and will be used my multiple web based GUIS, so I need to return a clean error message back to the GUI application without the application halting. I have seen multiple forum posts where people want to be able to do this. If you want to call these functions without calling the internal functions directly, just put these functions in system\database\DB_Driver.php Code: .. I am also using PHP5 and calling the internal functions directly still works! As these functions are used to display the standard CI database error message when db_debug is TRUE. Is there any reason why they are internal only? How to prevent CI from dumping SQL on screen when err occurs? - El Forum - 11-11-2007 [eluser]gunter[/eluser] you can switch the messages off config/database.php Code: $db['default']['db_debug'] = FALSE; How to prevent CI from dumping SQL on screen when err occurs? - El Forum - 11-11-2007 [eluser]gtech[/eluser] [quote author="gunter" date="1194808677"]you can switch the messages off config/database.php Code: $db['default']['db_debug'] = FALSE; yes you have to do that for the code to work in reply 3, if you don't you cant catch the errors. does anyone know why db->_error_message and db->_error_number are internal only? |