I created the database "publications" in mysql and established a connection to it in PHP but could not access it. And I got the error message: "Database access failed" as I wrote in the end of the code. Here is the code from PHP:
<?php
require_once 'login.php';
$conn = new mysqli($hn, $un, $pw, $db);
if($conn->connect_error) die("Fatal Error");
$query = "CREATE TABLE cats(
id SMALLINT NOT NULL AUTO_INCREMENT,
family VARCHAR(32) NOT NULL,
name VARCHAR(32) NOT NULL,
age TINYINT NOT NULL,
PRIMARY KEY(id)
)";
$result = $conn->query($query);
if(!$result) die("Database access failed"); //I am stuck here
?>