Jump to content

Paragraph Breaks, Text Format In Echoed Mysql Table Text?


paulmo
 Share

Recommended Posts

You mean you want the newlines converted to breaks? nl2br().Or if you want paragraphs instead of double newlines? (Untested:)

$string = preg_replace("/((\r)?\n){2,}(.*?)((\r)?\n){2,}/s", "\n<p>$3</p>\n", $string);

Link to comment
Share on other sites

thanks for the responses. yes i'm in php, so str_replace or regex? thanks for that regex code. use <pre> in db table text or php code? or with regex, put code after echo $row? thanks for php manual link. i'll put together something and post it here.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...