If you have a bunch of text that is properly formatted with carriage
returns/linefeeds between the paragraphs and you then try to send this to a
browser, the carriage returns/linefeeds will be ignored and you wind up with
one big paragraph. You could surround the whole thing with <pre> and
</pre>, but the nl2br($string) function will nicely replace each linefeed
with the <br> tags and display what you want in the browser.
Thus, you can store several paragraphs of data in database text field with
the CR/LF, but when it is time to show this on a page, run it though
nl2br(). This way, you have the convenience of editing the field's data
normally, but the formatting flows through to the screen.
I'll stop typing now, since I am getting a little long in the tooth.
John
> -----Original Message-----
> From: Matthew Cothier [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, February 21, 2001 4:11 PM
> To: [EMAIL PROTECTED]
> Subject: [PHP-DB] nl2br()
>
>
> Where exactly do I need to insert this?
> _________________________________________________________________________
> Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.
>
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]