DataRater Posted August 18, 2008 Share Posted August 18, 2008 MySQL 5 and PHP 5 When I display the contents of a text column using PHP no newlines are performed. I can see them in the text field when using SLOyog to view the contents. How can I get them back? Link to comment https://forums.phpfreaks.com/topic/120165-solved-losing-newlines-when-displaying-the-contents-of-a-mysql-column/ Share on other sites More sharing options...
Mchl Posted August 18, 2008 Share Posted August 18, 2008 If the content is to be displayed within HTML page, you have to replace all newline characters (usually \n, but also \r or \n\r ) with <br/> tag Link to comment https://forums.phpfreaks.com/topic/120165-solved-losing-newlines-when-displaying-the-contents-of-a-mysql-column/#findComment-619065 Share on other sites More sharing options...
xenophobia Posted August 18, 2008 Share Posted August 18, 2008 Use php's nl2br to convert all the newline to <br />. Link to comment https://forums.phpfreaks.com/topic/120165-solved-losing-newlines-when-displaying-the-contents-of-a-mysql-column/#findComment-619067 Share on other sites More sharing options...
DataRater Posted August 18, 2008 Author Share Posted August 18, 2008 Perfect. Thanks a lot. Link to comment https://forums.phpfreaks.com/topic/120165-solved-losing-newlines-when-displaying-the-contents-of-a-mysql-column/#findComment-619072 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.