Jump to content

Line Breaks In MySQL Withour <br> tag


$cripts

Recommended Posts

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 &lt; and > with &gt; so that their HTML shows up as HTML text instead of being rendered.
[!--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 &lt; and > with &gt; so that their HTML shows up as HTML text instead of being rendered.
[/quote]

lol man.....simple stuff gets me so confusseld sometimes

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.