Using This Script We can connect phpMysql.

———————————————————————————— 

<?

// hostname or ip of server

$servername=’localhost’;

// username and password to log onto db server

$dbusername=’Username;

$dbpassword=’password’;

// name of database

$dbname=’a’;

connecttodb($servername,$dbname,$dbusername,$dbpassword);

function connecttodb($servername,$dbname,$dbuser,$dbpassword)

{

global $link;

$link=mysql_connect (“$servername”,”$dbuser”,”$dbpassword”);

if(!$link){die(“Could not connect to MySQL”);}

mysql_select_db(“$dbname”,$link) or die (“could not open db”.mysql_error());

}

?>

 

—————————————————————————————————