Example #1
0
function getFirstRow($query)
{
    $rpta = getResultSet($query);
    if ($rpta) {
        return mysqli_fetch_row(getResultSet($query));
    }
    return array();
}
Example #2
0
        include "../FORMS/usermodal.html";
    }
    //saves the edited values that were submitted from user update modal
    if ($_POST['change'] === "edit") {
        $email = $_POST['email'];
        $fname = $_POST['firstname'];
        $lname = $_POST['lastname'];
        $userid = $_POST['primarykey'];
        $accountlocked = $_POST['accountlocked'];
        $loginattempts = $_POST['loginattempts'];
        $sqlupdate = "UPDATE {$table} SET FirstName='{$fname}', LastName = '{$lname}', Email = '{$email}', AccountLocked = {$accountlocked}, LoginAttempts = {$loginattempts} WHERE {$PK}= '{$userid}'";
        query($conn, $sqlupdate);
    }
    //adds a comment to a request
    if ($_POST['change'] === 'editrequest') {
        $comment = $_POST['comment'];
        $requestid = $_POST['primarykey'];
        $sqlupdate = "UPDATE {$table} SET Comment = '{$comment}' WHERE {$PK}={$requestid}";
        query($conn, $sqlupdate);
    }
    //simply generates the table for the admin page. Works for both the requests and users table
    if ($_POST['change'] === 'none') {
        $sqlData = "SELECT * FROM {$table}";
        $sqlTitles = "SHOW COLUMNS FROM {$table}";
        $rsData = getTableData($conn, $sqlData);
        $rsTitles = getTableData($conn, $sqlTitles);
        $arrayData = getResultSet($rsData);
        $arrayTitles = getResultSet($rsTitles);
        generateTable($table, $PK, $arrayTitles, $arrayData);
    }
}