SkyRanger Posted April 20, 2007 Share Posted April 20, 2007 I am having a problem with the output in php from mysql When somebody posts a message such as: Hello how are you, I am fine. and another para... etc. Well when I pull it back out of mysql to display it shows: Hello how are you,I am fine.and another para...etc. Is there any way I can fix this? Quote Link to comment https://forums.phpfreaks.com/topic/47956-solved-problem-with-output/ Share on other sites More sharing options...
SkyRanger Posted April 21, 2007 Author Share Posted April 21, 2007 ~~Bump~~ Quote Link to comment https://forums.phpfreaks.com/topic/47956-solved-problem-with-output/#findComment-234423 Share on other sites More sharing options...
MadTechie Posted April 21, 2007 Share Posted April 21, 2007 Is there any way I can fix this? Yes, but i am finding it quite hard to read the code you supplied.. can you re-post it Quote Link to comment https://forums.phpfreaks.com/topic/47956-solved-problem-with-output/#findComment-234426 Share on other sites More sharing options...
hackerkts Posted April 21, 2007 Share Posted April 21, 2007 Before the the message is insert into the database, replace all \n with <br>. Quote Link to comment https://forums.phpfreaks.com/topic/47956-solved-problem-with-output/#findComment-234432 Share on other sites More sharing options...
MadTechie Posted April 21, 2007 Share Posted April 21, 2007 Huh!! whar are you talking about hackerkts ? ??? Quote Link to comment https://forums.phpfreaks.com/topic/47956-solved-problem-with-output/#findComment-234434 Share on other sites More sharing options...
SkyRanger Posted April 21, 2007 Author Share Posted April 21, 2007 Ok, user types entry into a textarea example of textarea box: This would be a test message that the user would type. This would be the start of there next paragraph and so on. Signed Guest User This is how it would output on the page after I pulled it from mysql:This would be a test message that the user would type.This would be the start of there next paragraphand so on.SignedGuest User I need to figure out how to either have it inserted with the line breaks without the visitor having to manually put them in or have my php code automatically put them in when it is pulled out of mysql. In my table I am using: omsg text Quote Link to comment https://forums.phpfreaks.com/topic/47956-solved-problem-with-output/#findComment-234436 Share on other sites More sharing options...
hackerkts Posted April 21, 2007 Share Posted April 21, 2007 Huh!! whar are you talking about hackerkts ? ??? Argh.. Sorry I forgotten to put the code's tag. Replace /n with <br> before you submit the informations into the database. Quote Link to comment https://forums.phpfreaks.com/topic/47956-solved-problem-with-output/#findComment-234437 Share on other sites More sharing options...
MadTechie Posted April 21, 2007 Share Posted April 21, 2007 i'm not sure if that was the question if it was use nl2br() on the data return'd from the database its quicker Quote Link to comment https://forums.phpfreaks.com/topic/47956-solved-problem-with-output/#findComment-234441 Share on other sites More sharing options...
hackerkts Posted April 21, 2007 Share Posted April 21, 2007 Hmm think if he implement bbcode into his message board would be much more better. Take a look at this link, http://www.desilva.biz/php/bbcode1.html Quote Link to comment https://forums.phpfreaks.com/topic/47956-solved-problem-with-output/#findComment-234442 Share on other sites More sharing options...
MadTechie Posted April 21, 2007 Share Posted April 21, 2007 theirs lots you can do to "improve" BBcode, image support, Bots etc the list goes on LOL Quote Link to comment https://forums.phpfreaks.com/topic/47956-solved-problem-with-output/#findComment-234446 Share on other sites More sharing options...
SkyRanger Posted April 21, 2007 Author Share Posted April 21, 2007 Yeah, but I just need to be able to pull straight text from mysql and format it properly in the php page, when there is no html involved. Quote Link to comment https://forums.phpfreaks.com/topic/47956-solved-problem-with-output/#findComment-234451 Share on other sites More sharing options...
MadTechie Posted April 21, 2007 Share Posted April 21, 2007 use nl2br() if your displaying to the page then html is kinda involved! Quote Link to comment https://forums.phpfreaks.com/topic/47956-solved-problem-with-output/#findComment-234478 Share on other sites More sharing options...
SkyRanger Posted April 21, 2007 Author Share Posted April 21, 2007 Doh, should have known that, had to do that in a script about 2 weeks ago. Thanks MadTechie worked like a charm. Quote Link to comment https://forums.phpfreaks.com/topic/47956-solved-problem-with-output/#findComment-234507 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.