Home > Archive > PHP DB > August 2004 > Re: [PHP-DB] end of line
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Re: [PHP-DB] end of line
|
|
| Marcjon 2004-08-30, 3:56 am |
| Try this:
echo str_replace ( "\n", "<p>", $string);
I believe it always stores newlines as \n, since PHP and MySQL are
native to Unix/Linux.
--
Marcjon
| |
| Torsten Roehr 2004-08-30, 8:57 am |
| "Marcjon" <marcjon@fastmail.fm> wrote in message
news:1093844358.24698.203307089@webmail.messagingengine.com...
> Try this:
> echo str_replace ( "\n", "<p>", $string);
>
> I believe it always stores newlines as \n, since PHP and MySQL are
> native to Unix/Linux.
> --
> Marcjon
Or use the PHP built-in function nl2br():
http://de3.php.net/manual/en/function.nl2br.php
Regards, Torsten Roehr
| |
| Jasper Howard 2004-08-30, 3:56 pm |
| I would start with a <p>, then print the data from the database,
str_replace("\n","<p></p>",$string); and then end with a </p>, that way you
have opening and closing <p></p> tags.
--
-------------------------------------------------------------->>
Jasper Howard :: Database Administration
Velocity7
1.530.470.9292
http://www.Velocity7.com/
<<--------------------------------------------------------------
"Marcjon" <marcjon@fastmail.fm> wrote in message
news:1093844358.24698.203307089@webmail.messagingengine.com...
> Try this:
> echo str_replace ( "\n", "<p>", $string);
>
> I believe it always stores newlines as \n, since PHP and MySQL are
> native to Unix/Linux.
> --
> Marcjon
|
|
|
|
|