CodeIgniter Forums

Full Version: 404 error not database error ?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

[eluser]umefarooq[/eluser]
Hi how we can show 404 error page not A Database Error Occurred which also showing query, if any database error come it always shows 404 error message,

El Forum

[eluser]Barouma[/eluser]
It is not possible to customize your 404 error page if your web host has not enabled this facility for your website.

If your web host has this facility, you will usually find mentioning of this information somewhere in their documentation. In fact, if they mention somewhere that you can customize a file named ".htaccess", it probably means that you can also customize your 404 File Not Found error page.

The steps in customizing a 404 error page are given below.
Step 1: Create a customized 404 File Not Found Error page.
Step 2: Create a .htaccess file
Step 3: Upload both files.
Step 4: Test the page.

El Forum

[eluser]TheFuzzy0ne[/eluser]
I'd also suggest against doing that. If you're getting a database error, it should be handled gracefully. Throwing a page cannot be found error just seems wrong, as the page could be found, it was just a database error. Sorry, but hiding a database error behind the guise of being a 404 error just doesn't seem right to me.

El Forum

[eluser]umefarooq[/eluser]
as you can see when every database error is coming CI always showing query also which is not good, also showing tables name, in that case anybody try to inject sql and delete the table, how it is possible to hide queries not visible for online version.

El Forum

[eluser]TheFuzzy0ne[/eluser]
The query won't be shown if you disable db_debug in your config/database.php file. The query is only shown to help developers debug their app. If your app is on a production server, disable database debugging. Smile