PHP send mail help - my loop is wrong!

Hi everyone
I'm new here and posting because I have a problem with a PHP script I'm trying to write. I'm testing it as it goes along, but having a problem.

I want to select certain people from my database, and send each of them an e-mail. To test, I replaced their e-mail address with mine, so from the sample criteria I chose (ID greater than 800) I should have 5 e-mails, each personalised.

However, the first e-mail is fine, but the 2nd e-mail contains details of person 1 and person 2. The 3rd e-mail contains details of person 1, person 2 and person 3 etc. The screen echo shows 'Mail was sent' 5 times.

I think this is to do with how it is looping, i.e. where the } is? But I can't figure it out.

Please could you nice people take a look and tell me where it's going wrong?