Better mysqli table creation

<?php
$mysqli = new mysqli(DB_SERVER,DB_USER,DB_PASS,DB_NAME);

if($mysqli->connect_errno) echo "Failed to connect to MySQL: (" . $mysqli->connect_errno . ") " . $mysqli->connect_error;
echo $mysqli->host_info . "n";

$query = "CREATE TABLE hwt_tools(
id mediumint(8) NOT NULL AUTO_INCREMENT,
user_id mediumint(8),
category_id mediumint(8),
target_url varchar(255),
favicon_url varchar(255),
desc_text text,
UNIQUE KEY id (id)
);";

//Use this to safely create a table while testing
if(!$mysqli->query($query)) echo "Table creation failed: (" . $mysqli->errno . ") " . $mysqli->error;

//Use this to drop existing table and start a new
//if(!$mysqli->query("DROP TABLE IF EXISTS hwt_tools") || !$mysqli->query($query)) echo "Table creation failed: (" . $mysqli->errno . ") " . $mysqli->error;

?>

Database Constants

<?php

//Database Contants
defined('DB_SERVER') ? null : define("DB_SERVER","localhost");
defined('DB_NAME') ? null : define("DB_NAME","put_db_name_here");
defined('DB_USER') ? null : define("DB_USER","put_db_username_here");
defined('DB_PASS') ? null : define("DB_PASS","put_db_password_here");

?>

Gravity Forms file upload query

<?php

//Connect to Database
$gravity_post_id = get_the_ID();

$dbc = mysqli_connect('localhost','dankuniv_wp02','H0fx81McyP','dankuniv_wp02')
or die('Error connecting to Database');

//This query gets the secondary ID
$query = "SELECT id
FROM wp_rg_lead
WHERE post_id = $gravity_post_id
LIMIT 0 , 30";

$result = mysqli_query($dbc, $query);
$row = mysqli_fetch_array($result);

//The secondary ID from above
$secondary_id = $row[0];

if ($row[0] != ''){

//This query grabs the file URL
$query2 = "SELECT value
FROM wp_rg_lead_detail
WHERE lead_id = $secondary_id
AND field_number = 3
LIMIT 0 , 200";

$result2 = mysqli_query($dbc, $query2);
$row2 = mysqli_fetch_array($result2);

//Create Source file link:
if ($row2[0] == ''){
//Empty field - exit conditional;
}
else {
echo '<a href="' . $row2[0] . '"><img src="/graphics/download_source.png" /></a>';
}
}

//Close the Connection
mysqli_close($dbc);

?>

SQL Query

<?php

$dbc = mysqli_connect('localhost','the_database_user','the_database_password','the_database_name') or die('Error connecting to Database');

$query = "SELECT *
FROM table_name
WHERE id = 1
LIMIT 0 , 30";

$result = mysqli_query($dbc, $query);

$row = mysqli_fetch_array($result);

echo $row[0];

//Close the Connection
mysqli_close($dbc);

?>