$cripts Posted March 21, 2006 Share Posted March 21, 2006 Ok so i have a forum i developed and right now im using bbcode as a way to have line breaks but how would i do it so when they go down a line it does it by itself.SoI CanDo Thiswithout using bbcode and adding [br] with each one it just does it itself Quote Link to comment https://forums.phpfreaks.com/topic/5454-line-breaks-in-mysql-withour-tag/ Share on other sites More sharing options...
wickning1 Posted March 21, 2006 Share Posted March 21, 2006 Store it in MySQL exactly as you get it from the user. Then when you are displaying it, use something like:[code]echo nl2br(htmlspecialchars($row['text']));[/code]That will replace line breaks with <br> and will also replace < with < and > with > so that their HTML shows up as HTML text instead of being rendered. Quote Link to comment https://forums.phpfreaks.com/topic/5454-line-breaks-in-mysql-withour-tag/#findComment-19501 Share on other sites More sharing options...
$cripts Posted March 21, 2006 Author Share Posted March 21, 2006 [!--quoteo(post=357133:date=Mar 21 2006, 06:08 PM:name=wickning1)--][div class=\'quotetop\']QUOTE(wickning1 @ Mar 21 2006, 06:08 PM) [snapback]357133[/snapback][/div][div class=\'quotemain\'][!--quotec--]Store it in MySQL exactly as you get it from the user. Then when you are displaying it, use something like:[code]echo nl2br(htmlspecialchars($row['text']));[/code]That will replace line breaks with <br> and will also replace < with < and > with > so that their HTML shows up as HTML text instead of being rendered.[/quote]lol man.....simple stuff gets me so confusseld sometimes Quote Link to comment https://forums.phpfreaks.com/topic/5454-line-breaks-in-mysql-withour-tag/#findComment-19503 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.