Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Forcing CodeIgniter to show 404 page instead of any other error like 1064

How can replace error pages like

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 my website's default 404 error page?

like image 334
Sumit Sinha Avatar asked Jan 21 '13 08:01

Sumit Sinha


1 Answers

You can force 404 with the method

show_404();

This will show 404 when u want it. In your case just catch your error and use this function.

Or you can set custom error handler, log it and display 404, thought i wouldn't recommend doing that.

like image 73
eric.itzhak Avatar answered Sep 24 '22 20:09

eric.itzhak