[ticket/12759] Make sure $field_id has unique elements

Otherwise it would cause a bunch of repetitive IDs passed to the IN clause

PHPBB3-12759