If you are running a WordPress blog then you might have encountered this most common WordPress Error :“Error Establishing a Database Connection”.
This Error occurs when the WordPress is disconnected with the Database.It mostly occurs, when your webhost could not withstand too many simultaneous connections or something went wrong in wp-config.php file.
Very often If you encounter this error then It is time to look for better WebHost.
Lets come to the point,You know what went wrong but you must convenience your users to revisit your website after sometime.
So here is a hack to spice up your Database Error Page.
Open your Text Editor and paste the following code
header(‘HTTP/1.1 503 Service Temporarily Unavailable’);
header(‘Status: 503 Service Temporarily Unavailable’);
// mail("email@example.com", "Database Error", "Database Error", "From: Database Error Watcher");
font-family: "Times New Roman", Times;
Sorry for the Inconvenience.Check back later.
Now Save it as db-error.php and Upload to your blog’s wp-content / folder
If you want to receive a Email notification about Database Errors then simply uncomment the line no. 5 and replace default Email address with yours.
Note : Take a backup before editing wp-config.php to avoid any mishap.