Reputation: 8548
I have a longtext in a database. It looks fine from php_mayadmin, but when I echo it out to a page, it loose all formatting, i.e. no new lines, all in one chunk. Any ideas? :)
Thanks!
Upvotes: 2
Views: 1944
Reputation: 920
The string is stored with newlines representing the linebreaks. When you echo that, it just echos it into the source, so there are line breaks in the code. However, you want to have <br />
tags where the line breaks would be. PHP's nl2br function should work converts linebreaks into HTML <br>
tags - that should do what you want.
Upvotes: 1