CodeIgniter Forums
How to hide database error? - 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 hide database error? (/showthread.php?tid=16082)



How to hide database error? - El Forum - 02-24-2009

[eluser]murtuza54[/eluser]
Hi

I want to hide any database error like 1064 or 1054

exa :
Code:
A Database Error Occurred
Error Number: 1054

Unknown column ‘abc’ in ‘field list’

INSERT INTO `table1` (`ID`, `ss`, `jj`, `abc`)


as we know it shows defected query with table name and fields.
Is there any way to redirect that page to some other decorative error page?
I dont want to show any kind of database table name or error on site?


How to hide database error? - El Forum - 02-24-2009

[eluser]janogarcia[/eluser]
Hi,

Set db_debug to FALSE in application/config/database.php

Code:
$db['default']['db_debug'] = FALSE;

More info in the Database configuration documentation.


How to hide database error? - El Forum - 02-24-2009

[eluser]murtuza54[/eluser]
Thank you very much.
Its stops displaying database errors.

but can we redirect this to some other page?


How to hide database error? - El Forum - 02-24-2009

[eluser]murtuza54[/eluser]
I got answer for that.
In application/errors, there are all error files. i have put redirection code in each file to my custom error page. this way it works. other way is we can modify existing error pages also the way we like.

Thank you.