How to create database in PHP
Example
<html">
<head>
<title>Create Data Base</title>
</head>
<body>
<?php
$con=mysqli_connect('localhost','root','','mydatabase');
// Check connection
if (mysqli_connect_errno())
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
// Create database
$sql="CREATE DATABASE PHPAdmin";
if (mysqli_query($con,$sql))
{
echo "Database PHPAdmin created successfully";
}
else
{
echo "Error creating database: " . mysqli_error($con);
}
?>
</body>
</html>