07-30-db/userAddEditPost.php
<?php
require("authUser.php");

/* Setup the Connection Parameters */
$host = "127.0.0.1";
$user = "nerdarmy";
$pass = "";
$db = "testDB";
$port = 3306;

/* make a connection to the mySQL database */
$connection = mysqli_connect($host, $user, $pass, $db, $port) 
    or die(mysql_error());

$UID = $_GET["UID"];
$USERNAME = $_GET["USERNAME"];
$EMAIL = $_GET["EMAIL"];
$PASSWORD = $_GET["PASSWORD"];
$killme = $_GET["killme"];
$ISADMIN = $_GET["ISADMIN"];
if (!isset($ISADMIN)) {
    $ISADMIN = "0";
}

echo($UID . "<br>");
echo($USERNAME . "<br>");
echo($EMAIL . "<br>");
echo($PASSWORD . "<br>");

if ($UID == "0") {
    // insert a new record
    $query = "INSERT INTO Users ";
    $query .= "(USERNAME, EMAIL, PASSWORD, ISADMIN) VALUES ";
    $query .= "('$USERNAME', '$EMAIL', '$PASSWORD', $ISADMIN)";
    mysqli_query($connection, $query);
} else {
    
    if (isset($killme)) {
        // delete the user
        $query = "DELETE FROM Jokes WHERE SUBMITTEDBY=$UID";
        mysqli_query($connection, $query);

        $query = "DELETE FROM Users WHERE UID=$UID";
        mysqli_query($connection, $query);
    } else {
        // updating an existing record
        $query = "UPDATE Users SET ";
        $query .= "USERNAME='$USERNAME',";
        $query .= "EMAIL='$EMAIL',";
        $query .= "ISADMIN=$ISADMIN,";
        $query .= "PASSWORD='$PASSWORD' ";
        $query .= "WHERE UID=$UID";
        mysqli_query($connection, $query);
    }
    
}

echo($query . "<br>");
//header('Location: userList.php');

?>