如何同时启用linebreak,mysql_escape_string和htmlentities?

I am creating something like a facebook wall (post commenting system)

 mysql_real_escape_string(htmlentities($_POST['wallcomment']));

I store the result return by the above code in the tables, when i tried to display i out, i can display html code like 'test'

However, when i have linkbreak, it convert to etc. I am posting via a textarea.

How do i enable htmlentities and mysql_real_escape_string, while still catering the linkbreak..

Thanks!