diff --git a/html/includes/forms/attach-alert-template.inc.php b/html/includes/forms/attach-alert-template.inc.php
index 6f78353505..a99c8a6140 100644
--- a/html/includes/forms/attach-alert-template.inc.php
+++ b/html/includes/forms/attach-alert-template.inc.php
@@ -37,7 +37,7 @@ if (!is_numeric($_POST['template_id'])) {
}
if (!empty($ids)) {
- dbDelete('alert_template_map', 'id NOT IN ' . dbGenPlaceholders(count($ids)) . ' AND alert_templates_id =?', array_merge([$_POST['template_id']], $ids));
+ dbDelete('alert_template_map', 'id NOT IN ' . dbGenPlaceholders(count($ids)) . ' AND alert_templates_id =?', array_merge($ids, [$_POST['template_id']]));
echo "Alert rules have been attached to this template.";
exit;
}