<?php

$servername = "localhost";
$username = "root";
$password = "";

$conn = new mysqli($servername, $username, $password);

if($conn->connect_error){
    die("Connection failed: " .$conn->connect_error);
}else{
    echo "Connected successfully";
}

$db ="CREATE DATABASE IF NOT EXISTS AIdb";

if($conn ->query($db) === TRUE){
    echo "Database created successfully";
}else{
    echo "Error 404";
}

$db= "CREATE TABLE IF NOT EXISTS AIdb.users(
    id INT(6) UNSIGNED AUTO_INCREMENT PRIMARY KEY,
    username VARCHAR(150) NOT NULL,
    email VARCHAR(50) NOT NULL,
    password VARCHAR(255) NOT NULL,
    created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
)";

if($conn -> query($db) === TRUE){
    echo "Table created successfully";
}else{
    echo "Error 404 TABLE";
}
?>
