$tab_options['CACHE'] = 'RESET'; if (isset($protectedPost['del_check']) and $protectedPost['del_check'] != '') { $post_delete = $protectedPost['del_check']; } if (isset($protectedPost['SUP_PROF']) and $protectedPost['SUP_PROF'] != '') { $post_delete = $protectedPost['SUP_PROF']; } if (isset($post_delete)) { if ($table == "downloadwk_tab_values") { delete_tab($post_delete); } if ($table == "downloadwk_fields") { delete_field($post_delete); } if ($table == "downloadwk_conf_values") { delete_conf($post_delete); } } $queryDetails = "select ID," . $fields . " from " . $table . " where " . $field_search . "='%s' \n\t\t\t\t\tand (default_field is null or default_field=0) "; $argDetail = $protectedGet['value']; $resTypes = mysql2_query_secure($queryDetails, $_SESSION['OCS']["readServer"], $argDetail); $valTypes = mysql_fetch_array($resTypes); if (is_array($valTypes)) { $tab_options['ARG_SQL'] = $protectedGet['value']; if (!isset($protectedPost['SHOW'])) { $protectedPost['SHOW'] = 'NOSHOW'; } if (!isset($protectedPost["pcparpage"])) { $protectedPost["pcparpage"] = 5; } array_shift($array_fields);
function delete_field($id_field) { //delete all values of this field $id_field = prepare_id($id_field); if (is_array($id_field)) { $i = 0; foreach ($id_field as $id => $value) { $sql_downloadwk_pack = "ALTER TABLE downloadwk_pack DROP COLUMN fields_%s"; $arg_downloadwk_pack = $value; mysql2_query_secure($sql_downloadwk_pack, $_SESSION['OCS']["writeServer"], $arg_downloadwk_pack); $i++; } addLog('DEL_WK_TELEDIFF', 'delete fields on downloadwk_pack => ' . $i . ' column'); $id_values = find_all_value_by_field($id_field); $result = delete_conf($id_values); //if ($result){ $sql_downloadwk_fields = "DELETE FROM downloadwk_fields WHERE ID in "; $downloadwk_fields = mysql2_prepare($sql_downloadwk_fields, array(), $id_field); mysql2_query_secure($downloadwk_fields['SQL'], $_SESSION['OCS']["writeServer"], $downloadwk_fields['ARG']); addLog('DEL_WK_TELEDIFF', 'delete field (downloadwk_fields) => ' . mysql_affected_rows() . ' values'); return true; //} } return false; }