Forcing CodeIgniter to display 404 pages instead of any other error, such as 1064

How to replace error pages, for example

A Database Error Occurred Error Number: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'order by rand()' at line 1 

with the default 404 error page of my site?

+6
source share
1 answer

You can force 404 using the method

 show_404(); 

This will show 404 whenever you want. In your case, just catch your mistake and use this function.

Or you can install your own error handler, register it and display 404, I thought that I do not recommend doing this.

+13
source

All Articles