query($wpdb->prepare("DELETE FROM {$style_table} WHERE id = %d", $id)); } } if (!empty($_POST['duplicate']) && isset($_POST['id']) && is_numeric($_POST['id'])) { $nonce = $_REQUEST['_wpnonce']; if (!wp_verify_nonce($nonce, 'afaq_nonce_field_duplicate')) { die('You do not have sufficient permissions to access this page.'); } else { $id = (int) $_POST['id']; $selectedData = $wpdb->get_row($wpdb->prepare("SELECT * FROM $style_table WHERE id = %d ", $id), ARRAY_A); $dupList = array( $selectedData['name'], $selectedData['style_name'], $selectedData['css'], $selectedData['templateids'], $selectedData['categoryids']); $s = $wpdb->query($wpdb->prepare("INSERT INTO {$style_table} (name, style_name, css, templateids, categoryids) VALUES ( %s, %s, %s, %s, %s )", $dupList)); } } ?>