PHP and MYSQL database connectivity

, by Prashant Gunjal


Syntax :
             mysql_connect("host","username","password");
here password is optional field if you have set password for mysql then you will require it.

<html>
<head>
    <title>PHP and MYSQL database connectivity </title>
</head>
<body>
<?php
    $con = mysql_connect("localhost","root");
    if($con)
        echo "<br> Connected succesfully !!!";
    else
        echo "<br>".mysql_error();
?>
</body>
</html>

OUTPUT :


0 comments: