freelance84 Posted July 23, 2010 Share Posted July 23, 2010 I have a similar problem to this thread, but not quite: http://www.phpfreaks.com/forums/index.php/topic,305228.0.html In a MySQL table of format MyISAM I have a long text string. The string has a few line breaks here an there as it is input from a text area. These line breaks are formatted ok when inputted into another textarea. However, when I try to put the text into a normal div, the line breaks are ignored and the text is viewed as one big lump (a big paragraph), like this: Football practice this month for the gremlins: Mike Jones on every other saturday. Smith on every other sunday. When i view the source however the breaks are there (sort of), here's the source of the html: Football practice this month for the gremlins: Mike Jones on every other saturday. Pete Smith on every other sunday. As you can see, the line breaks are there in the source code, but there are no line breaks printed in the browser. How do I add <br/> when I've nothing to search for (if that makes sense [how the text looks int he source is also how it is stored in mysql table]) Quote Link to comment https://forums.phpfreaks.com/topic/208652-linebreaks-into-divs-from-mysql/ Share on other sites More sharing options...
PravinS Posted July 23, 2010 Share Posted July 23, 2010 Try PHP nl2br() function Quote Link to comment https://forums.phpfreaks.com/topic/208652-linebreaks-into-divs-from-mysql/#findComment-1090043 Share on other sites More sharing options...
freelance84 Posted July 23, 2010 Author Share Posted July 23, 2010 http://php.net/manual/en/function.nl2br.php Gracias! Quote Link to comment https://forums.phpfreaks.com/topic/208652-linebreaks-into-divs-from-mysql/#findComment-1090047 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.