PHP Code to Fetch Variables from MySQL & Retain Formatting
Posted on 2009-03-31
I am trying to build a website that will allow a search to be conducted of various comments that were made. It will be for internal use only. I am using PHP. It will search by name and then return the comments the user made.
I need it to retain the exact formatting as entered. Inside the MySQL database there are line breaks, etc.
I am writing the PHP to output it to screen. It destroys all of the formatting, however, and just concatenates it all into a large lump. I must have the formatting retained. It is fine in the MySQL database so getting it on screen shouldn't be too hard.
My code looks like:
while ($row= mysql_fetch_array($result))
echo "<p><b>Comments:</b><br>" .$row['Quarter3Eval']. "</b></p>";
If the comment initially were:
This is line A.
This is line B.
This is line C.
It smashes it together and outputs: "This is line A. This is line B. This is line C."
How can I get the output to the screen without that loss of format?