March 21st, 2013, 08:58 PM
LineBreaks from MySQL to PHP?
How can you get the line breaks to work when you retrieve data from MySQL to PHP?4 Blue
March 21st, 2013, 09:01 PM
Depends. Where are these line breaks going? What does your code look like?
March 24th, 2013, 01:13 PM
Is the issue that the data in the database contains new-line or carriage-return characters and you wish the output to represent that to the user?
Originally Posted by icechua
Then you need to understand that what you display to the user is in HTML. The browser, as you have observed, ignores line breaks. So wherever there is a line break in the input data you need to insert a <br> or <p>. For example:
March 24th, 2013, 01:35 PM
What jcobban says is only partly true. The browser will honor line breaks if you enclose the text in <pre></pre> tags. Of course then all of the enclosed text has to be formatted for it to look the way you want.
There are 10 kinds of people in the world. Those that understand binary and those that don't.
March 24th, 2013, 07:01 PM
Or you could just pass your text through nl2br() to convert newline to <br>
Originally Posted by gw1500se