After a recent WordPress update (to 3.3), one of my blogs showed the following error:
Couldn't connect to database server. Couldn't find database magical_rules. An unexpected problem has occured with the application. SELECT statscurl_id FROM `statscurl` WHERE statscurl_ip = '';
So how to solve this problem? Googling lead me to various websites and blogs that discussed possible solutions to this problem. This seems to be a problem specifically with Elegant Themes. Below is what worked for me.
While opening my blogs, I have always wondered why the page was trying to access "http://www.4llw4d.freefilesblog.com". This looked fishy to me. I tried to find out but gave up after a few minutes. I discovered that something had changed in this link "http://www.4llw4d.freefilesblog.com" and that was causing the database error described above.
In order to solve the above problem, edit the header.php file located under /wp-content/themes/ThemeName. You may do this from wordpress dashboard->Appearance->Editor or using your favorite text editor if you have access to the server.
Find the following line:
$url = "http://www.4llw4d.freefilesblog.com/jquery-1.6.3.min.js";
Comment it out as shown below so that the line is skipped during page display.
/* $url = "http://www.4llw4d.freefilesblog.com/jquery-1.6.3.min.js"; */
Save the file and refresh your page. The database error should now go away.
If you would like to optimize your WordPress URL structure to make it more search engine and user friendly, please read this post.
Hope this helps.