[SOLVED]New Lines from db not showing up in HTML

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
anjanesh
DevNet Resident
Posts: 1679
Joined: Sat Dec 06, 2003 9:52 pm
Location: Mumbai, India

[SOLVED]New Lines from db not showing up in HTML

Post by anjanesh »

I have a query which gets a filed $row['story'] that contains many newlines. But when displaying it as

Code: Select all

echo $row['story']
or

Code: Select all

echo htmlentities($row['story'])
somehow it displays it an an entire non stop string with no newlines etc.
Any idea how to get this fixed. Its like \n should be converted to <BR> ? Does this have to been done manually or some fn like htmlenties etc will do it ?
Thanks
Last edited by anjanesh on Thu Jul 01, 2004 4:46 am, edited 1 time in total.
Grim...
DevNet Resident
Posts: 1445
Joined: Tue May 18, 2004 5:32 am
Location: London, UK

Post by Grim... »

You need [php_man]nl2br[/php_man]().
User avatar
anjanesh
DevNet Resident
Posts: 1679
Joined: Sat Dec 06, 2003 9:52 pm
Location: Mumbai, India

[SOLVED]

Post by anjanesh »

Thanks
SOLVED
Post Reply