正常查看转义字符串

I use mysqli_real_escape_string() when users enter data, I have a private messaging system and each message they enter is escaped using the function. Now, the data entered is text and is saved into a database. So when I retrieve it from the database and echo it, it puts backslashes and certain letters in it. So for example..

Here's a couple...not sure which one will work best though...

Displays as..

Here\'s a couple...not sure which one will work best though...
\

How can I prevent the slashes and r/n letters from appearing?

Stripslashes() changes it to this..

Here's a couple...not sure which one will work best though...rnrn

I still need the letters to go

Use stripslashes to remove \'

$str = "Is your name O\'reilly?
";

// remove new lines
$str = str_replace(array("
", ""), array('', ''), $str);

// Outputs: Is your name O'reilly?
echo stripslashes($str);

Also, please note that you should avoid using PHP's mysql* functions. See here

use nl2br() with stripslashes()

nl2br — Inserts HTML line breaks before all newlines in a string

nl2br(stripslashes($result));

it will return string with <br /> or <br> inserted before all newlines ( , , and ).