CREATE TABLE IF NOT EXISTS fails with table already exists
To avoid outputting anything, test for the table in your php before trying to create the table. For example,
$querycheck='SELECT 1 FROM `USERS`';
$query_result=$dbConnection->query($querycheck);
if ($query_result !== FALSE)
{
// table exists
} else
{
// table does not exist, create here.
}
Try this
$query = "SELECT ID FROM USERS";
$result = mysqli_query($dbConnection, $query);
if(empty($result)) {
$query = "CREATE TABLE USERS (
ID int(11) AUTO_INCREMENT,
EMAIL varchar(255) NOT NULL,
PASSWORD varchar(255) NOT NULL,
PERMISSION_LEVEL int,
APPLICATION_COMPLETED int,
APPLICATION_IN_PROGRESS int,
PRIMARY KEY (ID)
)";
$result = mysqli_query($dbConnection, $query);
}
This checks to see if anything is in the table and if it returns NULL
you don't have a table.
Also there is no BOOLEAN
datatype in mysql, you should INT
and just set it to 1 or 0 when inserting into the table. You also don't need single quotes around everything, just when you are hardcoding data into the query.
Like this...
$query = "INSERT INTO USERS (EMAIL, PASSWORD, PERMISSION_LEVEL, APPLICATION_COMPLETED, APPLICATION_IN_PROGRESS) VALUES ('[email protected]', 'fjsdfbsjkbgs', 0, 0, 0)";