Tuesday, 20 February 2018

PHP Create Database MySQL

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

Global Infrastructure and its components in AWS

You may operate your workloads wherever and however you choose with the AWS Global Infrastructure, and you'll use the same network, cont...