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'];
foreach ($selected_angel_types as $selected_angel_type_id) {
if (sql_num_query("SELECT * FROM `UserAngelTypes` WHERE `user_id`=" . sql_escape($user['UID']) . " AND `angeltype_id`=" . sql_escape($selected_angel_type_id) . " LIMIT 1") == 0)
sql_query("INSERT INTO `UserAngelTypes` SET `user_id`=" . sql_escape($user['UID']) . ", `angeltype_id`=" . sql_escape($selected_angel_type_id));
$deleted_angel_type_names = array();
$added_angel_type_names = array();
foreach($selected_angel_types_source as $source_angel_type) {
if (!in_array($source_angel_type["angeltype_id"], $selected_angel_types)) {
sql_query("DELETE FROM `UserAngelTypes` WHERE `user_id`='" . sql_escape($user['UID']) . "' AND `angeltype_id` = ". sql_escape($source_angel_type["angeltype_id"]));
}
}
foreach($selected_angel_types as $selected_angel_type) {
if (!in_array($selected_angel_type, $selected_angel_types_source_ids)) {