Create database
Syntax:
Create database databasename:
E.g
create database lp;
Example:
<?php
$servername=
'localhost’;
$username = 'root';
$password = '';
$con =
mysqli_connect($servername, $username, $password);
if(! $con )
{
die('Could not connect: ' . mysqli_error());
}
echo 'Connected
successfully';
$sql="create database lp";
if
($con->query($sql) === TRUE) {
echo "Database created
successfully";
}
else {
echo "Error creating database: "
. $con->error;
}
mysqli_close($con);
?>
Output:
Connected
successfully
Database created
successfully
No comments:
Post a Comment