$servername = "localhost";
$username = "root";
$password = "";
$dbname = "myDB";
$conn = mysqli_connect($servername, $username, $password);
if (!$conn) {
die("Connessione fallita: " . mysqli_connect_error());
}
$sql = "CREATE DATABASE myDB";
if (mysqli_query($conn, $sql)) {
echo "Database creato con successo";
} else {
echo "Errore: " . mysqli_error($conn);
}
$conn = new mysqli($servername, $username, $password, $dbname);
if ($conn->connect_error) {
die("Connessione fallita: " . $conn->connect_error);
}
$sql="CREATE TABLE employees ( id INT NOT NULL PRIMARY KEY AUTO_INCREMENT, lastname VARCHAR(20), firstname VARCHAR(20), phone VARCHAR(20), dateofbirth DATE )";
if (mysqli_query($conn, $sql)) {
echo "Tabella creata con successo";
} else {
echo "Errore: " . mysqli_error($conn);
}