How To Make Database Connection In PHP -MySql

How To Make Database Connection In PHP -MySql

In this tutorial i will teach you How To Make Database Connection In PHP -MySql.I am using WAMP SERVER and Notepad++ as editor.

CODE:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<style type="text/css">
body
{
margin:0px auto;
width:980px;
font-family:"Trebuchet MS", Arial, Helvetica, sans-serif;	
}
h2
{
font-size:30px;
text-align:center;	
}
.text
{
color:#090;
text-align:center;
font-size:20px;	
}
.hr
{
clear:both;	
margin-top:60px;
border-bottom:solid 2px rgba(0,0,0,0.4);
}
.footer
{
width: 100%;
text-align: center;
padding-top: 0px;
font-size: 16px;
}
</style>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>How To Make Database Connection In PHP -MySql</title>
</head>

<body>
<h2>How To Make Database Connection In PHP - MySql</h2>
<div class="text">


<?php
$connection= mysql_connect("localhost","root","root");
if($connection){
echo "Connection Established";
}
else
{
echo "coonection fail";	
}
?>


</div>
<!--hr-->
<br /><br /><br /><br />
<hr />

<!--footer-->
<div class="footer">
<p>© 2013 All rights reserved by HighTechnology.in
<a href="http://hightechnology.in" target="_blank">HighTechnology.in</a>
| Hosting Partner <a href="http://www.grootstech.com" target="_blank">Grootstech Solutions</a></p>
</div>
</body>
</html>