Show line number that triggered database error. |
[eluser]nicholas.byfleet[/eluser]
I am about ready to pull my hair out. When there is a database error, does anyone know how to print the line # and file that triggered the database error. I am building quite a complicated application and the standard error is practically useless for debugging purposes. Your input would be greatly appreciated. Thanks.
[eluser]kulldox[/eluser]
I'm doing a little trick for solving such issues. I'm placing the following code in every method of my controllers: Code: log('debug',__FILE__.', '.__LINE__.', '.__CLASS__.'/'.__METHOD__.'/'.__FUNCTION__.''); This way I know at least what happened before or after that DB error. Hope this helps. Sure to this will be sent to log files
[eluser]InsiteFX[/eluser]
You can find all of this in the CodeIgniter users guide. users guide error handling Enjoy InsiteFX
[eluser]nicholas.byfleet[/eluser]
Thanks for the link, however this only explains how to show an error. I am trying to find a way to display the line # and file of the controller or model that actually triggered the error. Does that make sense?
[eluser]InsiteFX[/eluser]
There are no line numbers that you can display unless you create them. Why not just use a log file and output the the function name. Enjoy InsiteFX
[eluser]kulldox[/eluser]
You could actually do something I wrote before for DB, for ex after every mysql query: Code: // here goes the query itself Something like this should do the trick. Or you can use transactions like in the user guide here http://ellislab.com/codeigniter/user-gui...tions.html
[eluser]Rob Corley[/eluser]
Have a look at this quick and dirty solution:- http://stackoverflow.com/questions/10259...odeigniter |
Welcome Guest, Not a member yet? Register Sign In |