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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to print on seperate lines

Status
Not open for further replies.

iffoiffy

Programmer
Feb 24, 2005
67
CA
Hi,

I my MYSQL table I have a field with a type longtext.

In that field I have data entered like

2 cat
2 dog
1 horse
5 mouse


when I retrive that from that table and echo the variable

it gets printed like
2 cat 2 dog 1 horse 5 mouse

How can I print it the same way on seperate lines as it was in the database?

Thanks
 
add a [bode]<br />[/code] after each line of your output within the loop.
 
You have to consider that HTML is white space agnostic. Linbreaks are not intepreted in HTML.
You need to create valid HTML structure, including <br /> tags, wrap in <p> ...</p>.
If you inspect the source code, you'll se that the linbreaks are actually there.
A quick way to translate the newline chars into breaks is the function nl2br($string).
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top