Page 1 of 1

display line breaks from MySQL text field

Posted: Mon Jan 16, 2012 12:53 pm
by inosent1
i am not sure how to phrase the topic, but when i store the data from my php form it looks like this
first line

third line

fifth line
when i look at the mysql data field it looks the same way

but when i pull it from the DB to view the result is:
first line third line fifth line
how do i get it to show with the line breaks?

Re: display line breaks from MySQL text field

Posted: Mon Jan 16, 2012 1:23 pm
by twinedev
well where are you displaying it that it is showing all one line? As output in a browser?

If so, you either need to wrap it with styling retain spacing (ie, <pre>) or pass it through nl2br()

-Greg

Re: display line breaks from MySQL text field

Posted: Mon Jan 16, 2012 1:40 pm
by inosent1
thank you for your reply!

it works

Code: Select all

<td  valign=top><span class="style2"><?php echo nl2br("$notesa"); ?>