Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Restoring Carriage Returns from Mysql PHP onto HTML

Status
Not open for further replies.

dreamaz

Technical User
Dec 18, 2002
184
CA
Hi,

I have a small database with one field that has over 500 characters. WHen I restore the data, it comes all in one paragraph, the line breaks are not there that I originally stored the data as.

in asp I have something like:
Response.Write Replace( myString, vbCRLF, "<br>" )
that fixed that problem for me. But need to know how to do it in php

Any help appreciated.

Thanks

/JC
 
If your Newline characters are stored in the database (as they normally are)
try the command
Code:
echo nl2br($textstring);

PHP replaces everly \nl with an <br>-Tag

That should do it
 
COuldn't find anything that could help me so far

 
ORettinger thanks alot it worked!

/JC
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top