Code has been added to clipboard!

MySQL Database Statement

Example
<?php
  $host = 'host';
  $user = 'user';
  $pass = 'pass';
  // Create connection
  $conn = new mysqli($host, $user, $pass);  	
  // Check connection  	
  if ($conn->connect_error) {      
    die("Failed to connect: " . $conn->connect_error);
  }
  // Create database  	
  $sql = "CREATE DATABASE my_data";
  if ($conn->query($sql) === TRUE) {      	
    echo "Database creation successful";
  } else {
    echo "Failed to create database: " . $conn->error;
  }
  $conn->close();  
?>