This is the code
$mysqli = new mysqli( $db_host, $db_user, $db_pass, $db_name);
// instead of mysqli_connect, use object mysqli
if ($mysqli ->connect_errno) {
printf("Connect Failed: %s\n", $mysqli->connect_error);
exit();
}
$object_table = "CREATE TABLE IF NOT EXISTS test (
user_id bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT,
post_title text NOT NULL,
post_content text NOT NULL,
post_name VARCHAR(255) NOT NULL,
post_date datetime NOT NULL,
PRIMARY KEY(ID)
)";
if ($mysqli->query($object_table) === True){
printf("Table object inserted successfully.\n");
} else {
printf("Failed");
}
I am getting the output - FAILED, where I am doing wrong?