phpbeginner Posted January 12, 2007 Share Posted January 12, 2007 Okay back for dumb question # 2. When adding text to the Admin textarea and hitting return for a new paragraph, it doesn't break into a new paragraph on the website. I check MYSQL and its a new paragraph in there but how do I get this to display as a new paragraph on the webpage. Quote Link to comment Share on other sites More sharing options...
DarkendSoul Posted January 12, 2007 Share Posted January 12, 2007 Well if your displaying on html you need a <br /> break. ;) Quote Link to comment Share on other sites More sharing options...
trq Posted January 12, 2007 Share Posted January 12, 2007 Take alook at [url=http://php.net/nl2br]nl2br[/url]. Use it as you display your output.And please, more discriptive titles. Where not all [i]dumb[/i]. Quote Link to comment Share on other sites More sharing options...
Jessica Posted January 12, 2007 Share Posted January 12, 2007 Except for people who use Where for We're. Just Kidding! :-P Quote Link to comment Share on other sites More sharing options...
.josh Posted January 12, 2007 Share Posted January 12, 2007 Burn! Quote Link to comment Share on other sites More sharing options...
Barand Posted January 12, 2007 Share Posted January 12, 2007 Put another wayWrite the data to db with \nSo when you edit you can can use it againWhen you write to the browserUse nl2br()That will give you the breaks you designed. Quote Link to comment Share on other sites More sharing options...
trq Posted January 12, 2007 Share Posted January 12, 2007 [quote]Except for people who use Where for We're.[/quote]Oh... she wants to start something? :pYou cut me real deep just now. Quote Link to comment Share on other sites More sharing options...
Jessica Posted January 12, 2007 Share Posted January 12, 2007 At least you didn't use your for you're. That one makes me cry a little. Quote Link to comment Share on other sites More sharing options...
phpbeginner Posted January 12, 2007 Author Share Posted January 12, 2007 Okay, here is my output to the webpage......Can someone help me out a bit please. [code]<?php while($row=mysql_fetch_row($rs)) { echo("<p class='pagetitle'><strong>" . $row[1] . "</strong></p>"); echo("<p>" . $row[2] . "<br>"); echo("<p>" . $row[3] . "<br>"); } echo("</p>"); ?>[/code] Quote Link to comment Share on other sites More sharing options...
HuggieBear Posted January 12, 2007 Share Posted January 12, 2007 Try this:...[code]<?phpwhile($row=mysql_fetch_row($rs)){ // loop and add <br> tags foreach ($row as $k => $v){ $row[$k] = nl2br($v); } // echo the output echo("<p class='pagetitle'><strong>" . $row[1] . "</strong></p>"); echo("<p>" . $row[2] . "<br>"); echo("<p>" . $row[3] . "<br>"); } echo("</p>");?>[/code]Also, as someone suggested nl2br() in a post further up, it's normally customary to investigate the [url=http://uk.php.net/manual/en/function.nl2br.php]manual for that function[/url] and then post your code with what you've attempted based on what you learned from the manual :)RegardsHuggie Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.