<?php
$db_host = "localhost";
$db_username = "root";
$db_pass = "";
$db_name = "onlinestores";
// Run the actual connection here
$connect_dude=mysqli_connect("$db_host","$db_username","$db_pass","$db_name");
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}
?>
//creating table
<?php
include "connect_to_db.php";
$sql_command="CREATE TABLE admin(
id NOT NULL auto_increment,
username varchar(16) NOT NULL,
password varchar(16) NOT NULL,
last_login date NOT NULL,
PRIMARY KEY(id),
UNIQUE KEY username(username)
)";
if(mysqli_query($connect_dude,"$sql_command")){
echo "ookie dookie";
}else {
echo "it didn't work";
}
?>
The code doesn't create any table in the database and shows me echo statement "it didn't work".