ANTI 'RTFM' DISCLAIMER: I'm absolutely sure other folk have ran into this problem, but I've looked around and can't find any threads which address this. I've also looked at the manual and had no luck so please don't lecture me about reading the ****** manual.
END OF DISCLAIMER
Ok, here's the problem...
In the past if somebody filled out a textarea in a form and submitted it (with a view to inserting it into MySQL and then later displaying on a webpage) I would simply use nl2br (along with a few other functions) to get the thing displaying new lines properly when displaying on the website. So, I would use nl2br when calling the info from the database to display on the page. It was good. It worked. Life was fine.
Then one day I discovered that I need to use mysql_real_escape_string before inserting any user submitted variables into mySQL.
But now, thanks to mysql_real_escape_string() there are tonnes of \r\n's all over my database and all over my discussion forum on my website.
As far as I can tell mysql_real_escape_string is not capible of living in harmony with nl2br.
Is there any way I can fix this problem without using string replace functions all over the place?
Thanks!
website maintenance