Hi,

In last program we learned how to connect given database with PHP page. In this program, you can get an idea with how to create new database. If you have a basic knowledge in MySQL query, it will very helpful to understand to learn this PHP program.

Ok, Lets see the program

<?php
/* Create new  database */
$host = “localhost”;
$user = “root”;
$pass = “”;
$connect=mysql_connect($host, $user, $pass);
$query=”create database Trainee”; // This is your MySQL query(Database name is: Trainee)
$mysql=mysql_query($query); // executes a query on a MySQL database.
if($mysql)
{
echo “New Database is created successfully”;
}

?>

OUTPUT:

New Database is created successfully