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?
PHP/MYSQL - lines break up on db insert
Moderator: General Moderators
- social_experiment
- DevNet Master
- Posts: 2793
- Joined: Sun Feb 15, 2009 11:08 am
- Location: .za
Re: PHP/MYSQL - lines break up on db insert
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
“Don’t worry if it doesn’t work right. If everything did, you’d be out of a job.” - Mosher’s Law of Software Engineering
Re: PHP/MYSQL - lines break up on db insert
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.
- social_experiment
- DevNet Master
- Posts: 2793
- Joined: Sun Feb 15, 2009 11:08 am
- Location: .za
Re: PHP/MYSQL - lines break up on db insert
Apparently line breaks are stored as "\n" which the browser ignores.
“Don’t worry if it doesn’t work right. If everything did, you’d be out of a job.” - Mosher’s Law of Software Engineering
Re: PHP/MYSQL - lines break up on db insert
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.