From ef66360f69a0a2cc095c1f938ed634239e5ca576 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philip=20H=C3=A4usler?= Date: Sun, 1 Dec 2013 20:44:32 +0100 Subject: [PATCH] fix angeltype assign error --- includes/pages/user_settings.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/includes/pages/user_settings.php b/includes/pages/user_settings.php index 9705fcdf..6b999a2f 100644 --- a/includes/pages/user_settings.php +++ b/includes/pages/user_settings.php @@ -101,7 +101,9 @@ function user_settings() { // Assign angel-types $user_angel_type_info = array(); - sql_query("DELETE FROM `UserAngelTypes` WHERE `user_id`='" . sql_escape($user['UID']) . "' AND `angeltype_id` IN (" . implode(",", array_diff(array_keys($angel_types), $selected_angel_types)) . ")"); + $deleted_angel_types = array_diff(array_keys($angel_types), $selected_angel_types); + if(count($deleted_angel_types) > 0) + sql_query("DELETE FROM `UserAngelTypes` WHERE `user_id`='" . sql_escape($user['UID']) . "' AND `angeltype_id` IN (" . implode(",", $deleted_angel_types) . ")"); foreach ($angel_types_source as $angel_type) if (in_array($angel_type['id'], $selected_angel_types)) $user_angel_type_info[] = $angel_type['name'];