I have searched the web for an answer, but couldn't find one. So I'm hoping you guys could help.

I have a textarea field in a form that gets inserted into a MySQL database. The field is coded as a blob.

Before the data gets inserted (or updated), I stripslash the data then use the mysql_real_escape_string function.

The eventual use for this data is to be displayed on the screen as a toolltip when a visitor mouses over some highlighted text. I'm using javascript for this tooltip.

Some of the data is escaped properly, such as apostrophies and quotes, but when the javascript encounters a line break, I get an unterminated string constant error and the tooltip will not display.

When I go into the data and manually remove the line break, the tooltip works fine. However, this is not the solution I want.

I was under the impression that the mysql_real_escape_string would properly escape the line breaks, but I guess not.

Please let me know if I need to provide more information.

Thank you in advance,