Trying to create a database and table. When I go to phpAdmin from XAMPP it does not show the database or table I’m trying to create. Was wondering if anyone had any ideas about what I was doing wrong.
<?php
$host = "localhost";
$username = "root";
$password = " ";
$db = "database";
$conn = mysqli_connect($host, $username, $password, $db);
$sql = "CREATE DATABASE IF NOT EXISTS newsad_hw2; ";
$result = mysqli_query($conn, $sql);
if(!$result){
echo "Database creation failed";
}
else{
echo "Connection established, database created";
}
$sql2 = "CREATE TABLE IF NOT EXISTS tbl (id INT PRIMARY KEY AUTO_INCREMENT,
animal_name VARCHAR(50) NOT NULL,
comments VARCHAR(255) NOT NULL,
photo BLOB NOT NULL);";
$query = mysqli_query($conn, $sql2);
if(!$query){
echo "Table creation failed";
}else{
echo "Table created";
}
?>