I am trying to protect against sql injections by using mysql_real_escape_string before inserting data to the database:
$data=mysql_real_escape_string($_POST['data']);
Now, the data is stored as such:
That\\\'s an apostrophe.
This new line isn\\\'t displaying properly!
So, I am trying to get it to display correctly inside of a textarea after pulling it back out of mysql:
$data = nl2br($data);
For whatever reason, this does NOTHING. I've even tried str_replace
to replace the
'
s with a <br>
, but then the <br>
just displays within the textarea.
How do I get what's in my mysql to display as:
That's an apostrophe.
This new line isn't displaying properly!