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();
?>