<!DOCTYPE html>
<!--
********************************************************************************

    filename:    burnsinit.php
    description: Initialize burns database table
    inputs:      none
    outputs:     none
    actions:     none
    redirection: none

********************************************************************************
-->
<html>
    <head>
        <?php include 'head.html' ?>
        <script src = "navigation.js"></script>
    </head>
    <body>
        <?php include 'navigationmanagedatabase.html' ?>
        <h3>INITIALIZE BURNS</h3>
        <div id="content">
            <?php
                include 'functions.php';
                $conn = connectToDB();

/*
                ... drop burns table
*/
                $sql = "DROP TABLE IF EXISTS burns";
                if (!mysqli_query($conn, $sql)) {
                    error_log("Initialize Burns Error dropping table: " . mysqli_error($conn));
                    exit('"burns" NOT initialized');
                }
/*
                ... create burns table
*/
                $sql = "CREATE TABLE burns ("
                    . "burnId INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,"
                    . "startDateTime DATETIME NULL,"
                    . "endDateTime DATETIME NULL,"
                    . "duration INT UNSIGNED NULL,"
                    . "foodId INT UNSIGNED NULL,"
                    . "food VARCHAR(256) NULL,"
                    . DONENESSES . ","
                    . "comments VARCHAR(256) NULL,"
                    . "pitId INT UNSIGNED NULL,"
                    . "pitManufacturer VARCHAR(256) NULL,"
                    . "pitModel VARCHAR(256) NULL,"
                    . "blowerP INT UNSIGNED NULL,"
                    . "blowerI INT UNSIGNED NULL,"
                    . "blowerD INT UNSIGNED NULL,"
                    . "ventP INT UNSIGNED NULL,"
                    . "ventI INT UNSIGNED NULL,"
                    . "VentD INT UNSIGNED NULL)";
                if (!mysqli_query($conn, $sql)) {
                    error_log("Initialize Burns Error creating table: " . mysqli_error($conn));
                    exit('"burns" NOT initialized');
                }
                echo '"burns" initialized';
                mysqli_close($conn);
            ?>
        </div>
    </body>
</html>