There is nothing in your code that would explain this. But I strongly assume, that the pipes are in your data. Dump your variables to screen to see if that is true.
Maybe you split a pipe separated text file and split it wrong?
holli, /regexed monk/
Comment on Re: Pipe tag being entered into database