mySQL? ?
Tuesday, April 13th, 2010 at
4:43 pm
How can you get the line break or paragraph that you entered when you input the data when you retrieve it from mySQL?
Tagged with: MySQL
Filed under: sql
Like this post? Subscribe to my RSS feed and get loads more!
“CRLF” are stored in mysql as “rn”.
To recover the true text, fetch the data from your sql (say $txt) and use
$txt = str_replace ( “rn”,”
“,$txt);
This will show the correct CRLF on a normal text on screen.
(Use the same if the source is a
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 ””