function queryDeleteTable($param, $mysqli = '')
{
    if ($mysqli === '') {
        $mysqli = connect_DB();
    }
    recursive_trim($param);
    extract($param);
    $stmt = $mysqli->stmt_init();
    if ($stmt->prepare("DELETE FROM `table` WHERE Table_ID=?")) {
        $stmt->bind_param("s", $Table_ID);
        $stmt->execute();
        $stmt->close();
    } else {
        die($stmt->error);
    }
    $stmt = $mysqli->stmt_init();
    if ($stmt->prepare("DELETE FROM table_pages WHERE Table_ID=?")) {
        $stmt->bind_param("s", $Table_ID);
        $stmt->execute();
        $stmt->close();
    } else {
        die($stmt->error);
    }
    $mysqli->real_query("SELECT Field_ID\n                            FROM `table_fields`\n                            WHERE Table_ID='{$Table_ID}'");
    if ($result = $mysqli->use_result()) {
        $mysqli2 = connect_DB();
        while ($data = $result->fetch_assoc()) {
            queryDeleteTableField($data, $mysqli2);
        }
    } else {
        die($mysqli->error);
    }
    $result->close();
}
Beispiel #2
0
    }
    $mysqli->close();
    $mysqli_validation_routines = connect_DB();
    $mysqli_validation_routines->real_query("SELECT Validation_Routine \n                                                FROM `table_fields_secondary_validation` \n                                                WHERE Field_ID='{$Field_ID}'");
    $mysqli_select_parameters = connect_DB();
    $mysqli_select_parameters->real_query("SELECT b.Field_Name, a.Display  \n                                                FROM `table_fields_list_source_select` a, \n                                                     `table_fields` b  \n                                                WHERE a.Field_ID='{$Field_ID}' AND a.Select_Field_ID = b.Field_ID");
    $mysqli_where_parameters = connect_DB();
    $mysqli_where_parameters->real_query("SELECT b.Field_Name, a.Where_Field_Operand, a.Where_Field_Value, a.Where_Field_Connector \n                                                FROM `table_fields_list_source_where` a, \n                                                     `table_fields` b  \n                                                WHERE a.Field_ID='{$Field_ID}' AND a.Where_Field_ID = b.Field_ID");
} elseif (xsrf_guard()) {
    init_var($_POST['btnCancel']);
    init_var($_POST['btnSubmit']);
    if ($_POST['btnCancel']) {
        header('location: ListView_TableFields.php');
        exit;
    } elseif ($_POST['btnSubmit']) {
        queryDeleteTableField($_POST);
        header("location: ../success.php?success_tag=DeleteTableFields");
        exit;
    }
}
drawHeader();
drawPageTitle('Delete Table Field', 'Are you sure you wish to delete this table field?');
echo '<input type="hidden" name="Field_ID" value="' . $Field_ID . '">';
?>
<div class="container_mid">
<fieldset class="top">
Delete Table Field
</fieldset>

<fieldset class="middle">
<table class="input_form">