Ah ha! It was a missing } , apparently when I deleted a chunk I accidentaly deleted that too! I should have thought to look for that but it was the fact is was coming up with the error on the last line that got me, but then now I know what it was I'm guessing it was expecting it later.
The reason I didn't want to post the code unless absolutely necessary was because I have done before and the threads now appear in google when looking for the site. Is there a way to remove threads on here? I couldn't see one.
Not this one, but other ones where I (stupidly) actually put the whole url in the message so it comes up in google as mentionned. Boss googled it once and wants it off.