Converting Line Breaks

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
thoughtriot
Forum Commoner
Posts: 26
Joined: Thu Nov 07, 2002 9:32 pm

Converting Line Breaks

Post by thoughtriot »

I'm using MySQL to make a little news blog. I have a field called Entry, and it's a text field. I was wondering if when I hit the Return key 2 times to make a space in between paragraphs, how I could make that line visible on the page where I display the news entries. Because other people update the news, and they don't know that you need to put <br>s in to make line breaks, so they use the return key, and then the breaks don't show up when the entries are displayed. How do I convert blank lines to <br>s so they show up in my php page?
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

http://www.php.net/manual/en/function.nl2br.php
Description
string nl2br ( string string)
Returns string with '<br />' inserted before all newlines.
Post Reply