> The data is being entered into a textarea and is being stored as it is
> entered but with an addslashes right before insertion.
>
> On the extract I am doing the following:
>
> $row[description] = stripslashes($row[description]);

You don't have to use stripslashes() on data coming out of a database unless
you have magic_quotes_runtime enabled. If you find that you do need to call
it, then you're running addslashes() twice before the data is inserted.

> $row[description] = nl2br($row[description]);
> $row[description] = trim($row[description]);
>
> I was trying str_replace as follows but that wasn't working:
>
> $row[description] = str_replace("\n", "", $row[description]);

This will get rid of the \n, but leave the \r there. On windows, you'll
still see a newline even with just the \r remaining. If you know everything
is coming from Windows, replace \r\n with an empty string. Unix uses just a
plain \n and Macs use just \r, while Windows uses \r\n. Adjust your
str_replace accordingly if you need to account for data from all three
possible OS.

---John Holmes...


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to