Page 1 of 1

PHP/MYSQL - lines break up on db insert

Posted: Fri Dec 23, 2011 9:10 am
by cjkeane
Hi everyone,

I'm having n issue with how data appears when inserted in a db. When the data is inserted into the db, it goes in like so:

This is another test to see if long lines of text break up.
This is another
test to see if long lines of text break up. This is another
test to see if
long lines of text break up

but it should appear as one long paragraph of text and wrap around, eg:

This is another test to see if long lines of text break up. This is another
test to see if long lines of text break up. This is another test to see if
long lines of text break up

any ideas why this would be happening?

Re: PHP/MYSQL - lines break up on db insert

Posted: Fri Dec 23, 2011 3:31 pm
by social_experiment
Do you add line breaks (br tags) when you pass the code to the database? You can try using <pre> tags to display the data in your format

Re: PHP/MYSQL - lines break up on db insert

Posted: Fri Dec 23, 2011 4:23 pm
by cjkeane
no i don't add any line breaks which is why i was asking why it might be happening. i'll look into the pre tag and see if it helps. thanks.

Re: PHP/MYSQL - lines break up on db insert

Posted: Fri Dec 23, 2011 4:44 pm
by social_experiment
Apparently line breaks are stored as "\n" which the browser ignores.

Re: PHP/MYSQL - lines break up on db insert

Posted: Fri Dec 23, 2011 5:00 pm
by cjkeane
yes, i realize that. i've looking in the actual db and the field. there are no br's or \n's or \r\n's.