MYSQL DATABASE CONNECTION IN PHP
<?
$con = mysql_connect("localhost","sam","sam");
if($con)
{
echo "horey........... my database Connected.";
}
else
{
echo "Cannot Connect database ".mysql_error();
}
mysql_close($con);
?>
</body>
</html>
<!--- php tutorials with sam saifi -->
<html>
<head>
<title>php and mysql by sam saifi</title>
</head>
<body>
<head>
<title>php and mysql by sam saifi</title>
</head>
<body>
create mysql database connection with code
step by step
step1:- create connection to data like $con.
step2:-mysql_connect() having three para meter
step3:- first your server name like "localhost" if you use in local machine
step4:-secound is username by default it root but you can change easly.
step5:- thirld is password in local machine having null but you can change easly.
step6:- now data base connected;
<?
$con = mysql_connect("localhost","sam","sam");
if($con)
{
echo "horey........... my database Connected.";
}
else
{
echo "Cannot Connect database ".mysql_error();
}
mysql_close($con);
?>
</body>
</html>
<!--- php tutorials with sam saifi -->
Comments
Post a Comment