Re: Display paragraphs from a mysql db

From: Date: Sun, 24 Jun 2007 22:54:39 +0000
Subject: Re: Display paragraphs from a mysql db
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-257739@lists.php.net to get a copy of this message
On 6/24/07, nitrox . <c3.nitrox@hotmail.com> wrote:
hi all, I have a news section on a website that im coding that isnt displaying properly. Every paragraph in each news post is being displayed as one big paragraph. how can i display my paragraphs in proper form? The field the news story is stored in is set as longtext. here is a link to view. http://area51.chalkthree.com/index.php?pg=3 the first update shows what im having an issue with. each item in the numbered list should be on a seperate line. there are some line breaks as well for new paragraphs that arent displaying properly. here is the code i have:
                while($myrow = mysql_fetch_array($newsresults))
              {
             print "<br>";
                     print $myrow['news_topic'];
                     print "             ";
                     print $myrow['news_author'];
                     print "   ";
             print $myrow['topic_date'];
             print "<br>";
             print $myrow['news_message'];
                     print "<br>\n";
                                 }
nl2br() as found at http://php.ca/nl2br, as well as the other functions on that page. Works well - although you may to futz a little bit with the variations on break tags. Cheers - Miles Thompson

« previous php.general (#257739) next »