"I want the string to be stored in the database without the new lines."
bad practice.
It is better to store the string as it was entered, and only process it if you need a different format. Once you replace the newlines by breaks, there is no way of telling which BR tags are real BR tags, and which BR tags used to be newlines. That sounds like a trivial thing to worry about, but there will come a time when that is exactly what you need to do.