$child = $_get->get_news_child($category_id); if ($child->rows > 0) { $type = 'danger'; $msg = 'Cannot delete category because it contains one or more news'; } else { $_update->delete_category($category_id); $type = 'success'; $msg = 'Item(s) has been successfully removed'; } } } else { if ($action == 'visibility') { foreach ($category_id as $category_id) { $category_id = filter_var($category_id, FILTER_SANITIZE_NUMBER_INT); if ($option == 'yes') { $_update->update_visibility('Yes', $category_id); } else { if ($option == 'no') { $_update->update_visibility('No', $category_id); } } $type = 'success'; $msg = 'Changes has been saved'; } } else { if ($action == 'order') { foreach ($order as $key => $order) { $order = filter_var($order, FILTER_SANITIZE_NUMBER_INT); $_update->update_order($key, $order); $type = 'success'; $msg = 'Changes has been saved';