Sep
19
Filed Under (Programming & Design) by Nick
mysql
Liza asked:


How can you get the line break or paragraph that you entered when you input the data when you retrieve it from mySQL?

Comments

just "JR" on 22 September, 2008 at 4:11 pm #

“CRLF” are stored in mysql as “\r\n”.
To recover the true text, fetch the data from your sql (say $txt) and use
$txt = str_replace ( “\r\n”,”",$txt);
This will show the correct CRLF on a normal text on screen.
(Use the same if the source is a )


LegendaryDaniel on 23 September, 2008 at 5:50 pm #

There are several ways of achieving this.

The first is when you have a series of paragraphs in a single data field, simply include the html mark-up appropriate to the text. Either using the

and tag or the tag you can get the desired effect of line breaks.

Otherwise design your data-tables in such a way that each field of text is a single paragraph, then put the SQL inside the

tag on the page.

You can also bold and italic your data text by using these tags in the data. and ””


Post a Comment
Name:
Email:
Website:
Comments: