its ok it was my mistake, i placed the function within a foreach loop but when i moved it out of the loop it worked.
i think this topic is now solved as everythig seems to be working tip-top but i couldnt have done it without your help. thank you for the help i am very greatful