$data = $result->fetch_assoc(); extract($data); } else { die($mysqli->error); } $mysqli->close(); $mysqli = connect_DB(); $mysqli->real_query("SELECT c.`Page_Name`, b.Path_Filename\n FROM `table` a, `table_pages` b, `page` c\n WHERE a.`Table_ID` = b.`Table_ID` AND\n b.`Page_ID` = c.`Page_ID` AND\n a.`Table_ID` = '{$Table_ID}'"); } elseif (xsrf_guard()) { init_var($_POST['btnCancel']); init_var($_POST['btnSubmit']); if ($_POST['btnCancel']) { header('location: ListView_Tables.php'); exit; } elseif ($_POST['btnSubmit']) { queryDeleteTable($_POST); header("location: ../success.php?success_tag=DeleteTables"); exit; } } drawHeader(); drawPageTitle('Delete Table', 'Are you sure you wish to delete this table?'); echo '<input type="hidden" name="Table_ID" value="' . $Table_ID . '">'; ?> <div class="container_mid_large"> <fieldset class="top"> Delete Table </fieldset> <fieldset class="middle"> <table class="input_form">
function queryDeleteProject($param, $mysqli) { recursive_trim($param); extract($param); $stmt = $mysqli->stmt_init(); if ($stmt->prepare("DELETE FROM `project` WHERE Project_ID=?")) { $stmt->bind_param("s", $Project_ID); $stmt->execute(); $stmt->close(); } else { die($stmt->error); } //Delete all tables and fields, including all stuff related to those tables and fields //(table relations, field list sources, etc) $mysqli->real_query("SELECT `Table_ID`\n FROM `table`\n WHERE `Project_ID`='{$Project_ID}'"); if ($result = $mysqli->use_result()) { $mysqli2 = connect_DB(); while ($data = $result->fetch_assoc()) { queryDeleteTable($data, $mysqli2); } } else { die($mysqli->error); } $result->close(); //Delete all predefined lists $mysqli->real_query("SELECT `List_ID`\n FROM `table_fields_predefined_list`\n WHERE `Project_ID`='{$Project_ID}'"); if ($result = $mysqli->use_result()) { while ($data = $result->fetch_assoc()) { queryDeletePredefinedList($data); } } else { die($mysqli->error); } $result->close(); //Delete all database connections $stmt = $mysqli->stmt_init(); if ($stmt->prepare("DELETE FROM database_connection WHERE Project_ID=?")) { $stmt->bind_param("s", $Project_ID); $stmt->execute(); $stmt->close(); } else { die($stmt->error); } unset($_SESSION['Project_ID']); unset($_SESSION['Project_Name']); }
} } $ShowTables = TRUE; } else { die('Error getting tables: ' . $mysqli->error()); } } else { //Create a new database object, using SCV2 connection. //We will use this object to insert records into SCV2 based on retrieved table and field info. $SCV2_con = connect_DB(); foreach ($checkbox as $key => $current_table) { //Check if a table with this name already exists and delete it if it does exist. $result2 = $SCV2_con->query("SELECT Table_ID FROM `table` WHERE Table_Name = '{$current_table}' AND Project_ID='{$_SESSION['Project_ID']}'"); if ($result2->num_rows > 0) { $param = $result2->fetch_array(); queryDeleteTable($param, $SCV2_con); $result2->close(); } $SCV2_con->query("OPTIMIZE TABLE `table_fields`"); //Get new Table_ID $Table_ID = get_token(); $SCV2_con->real_query("INSERT INTO `table`(Table_ID, Project_ID, DB_Connection_ID, Table_Name, Remarks)\n VALUES('{$Table_ID}',\n '{$_SESSION['Project_ID']}',\n '{$DB_Connection_ID}',\n '{$current_table}',\n '')"); $add_file = 'add_' . $current_table . '.php'; $edit_file = 'edit_' . $current_table . '.php'; $detail_file = 'detailview_' . $current_table . '.php'; $list_file = 'listview_' . $current_table . '.php'; $delete_file = 'delete_' . $current_table . '.php'; $CSV_file = 'csv_' . $current_table . '.php'; $report_interface_file = 'reporter_' . $current_table . '.php'; $report_result_file = 'reporter_result_' . $current_table . '.php'; $report_result_pdf_file = 'reporter_pdfresult_' . $current_table . '.php';