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

apply function in R

1) apply function: It takes 3 arguments matrix,margin and function.. Example: m<-matrix(c(1,2,3,4),nrow=2,ncol=2) m #1 indicates it is ap...