$DB->query("UPDATE torrents SET GroupID='$NewGroupID' WHERE GroupID='$GroupID'");
$DB->query("UPDATE wiki_torrents SET PageID='$NewGroupID' WHERE PageID='$GroupID'");
$DB->query("UPDATE torrents_comments SET GroupID='$NewGroupID' WHERE GroupID='$GroupID'");
delete_group($GroupID);
$GroupID=$NewGroupID;
//Collages
$DB->query("SELECT CollageID FROM collages_torrents WHERE GroupID='$OldGroupID'");//Select all collages that contain edited group
while(list($CollageID)=$DB->next_record()){
$DB->query("UPDATE IGNORE collages_torrents SET GroupID='$NewGroupID' WHERE GroupID='$OldGroupID' AND CollageID='$CollageID'");//Change collage groupid to new ID
$DB->query("DELETE FROM collages_torrents WHERE GroupID='$OldGroupID' AND CollageID='$CollageID'");
$Cache->delete_value('collage_'.$CollageID);
}
$DB->query("SELECT ID FROM torrents WHERE GroupID='$OldGroupID'");