PHP and MYSQL create new database

, by Prashant Gunjal

<html>
<head>
    <title>PHP and MYSQL create new database </title>
</head>
<body>
<?php
    $con = mysql_connect("localhost","root");
    if($con)
    {
        echo "<br> Connected succesfully !!!";
        if(mysql_query("create database my_DB",$con))
            echo "<BR>New database created successfully";
        else
            echo mysql_error();
        mysql_close($con);
    }
    else
        echo "<br>Connection error .... ".mysql_error();
?>
</body>
</html>

OUTPUT :


0 comments: