if(strpos($_SERVER['HTTP_HOST'],"localhost")>=0)
{
$con = mysql_connect('localhost', 'root', '');
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
}
else if(strpos($_SERVER['HTTP_HOST'],"www.mydomain.com")>=0)
{
$con = mysql_connect('localhost', 'Eexam', 'exam');
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
}
This code is making a connection in localhost but doesn't working in my live server . I will appreciate you if have a solution.