Jump to content

Newline and Return in MySQL to PHP


penguinin thedark

Recommended Posts

MySQL version 3.23.58

 

Dearest MySQL experts,

 

I have created a program to edit a database entry using PHP and MySQL.

 

The MySQL text content (for example) is:

 

"Lorem ipsum dolor sit amor et ibam forte via sacra sicut meus est mos, nescio quid meditans nugarum totus in illis.

 

Accurrit quidam notus mihi nomine tantum, arreptaque manu, quid agis, dulcissime rerum?"

 

*Notice the paragraph break.

 

When I pull this entry onto the webpage for viewing using PHP ( but not to edit) it outputs:

 

"Lorem ipsum dolor sit amor et ibam forte via sacra sicut meus est mos, nescio quid meditans nugarum totus in illis. Accurrit quidam notus mihi nomine tantum, arreptaque manu, quid agis, dulcissime rerum?"

 

*Notice no paragraph break.

 

When I select Edit so that the text comes straight from MySQL into a textarea for editing, it shows up as:

 

[begin textarea box]

"Lorem ipsum dolor sit amor et ibam forte via sacra sicut meus est mos, nescio quid meditans nugarum totus in illis.

 

Accurrit quidam notus mihi nomine tantum, arreptaque manu, quid agis, dulcissime rerum?"

[End textarea box]

 

*Notice that the paragraph break is in place.

 

I have tried a replace of \r\n and \r\n\r\n (with appropriate pre-backslashes) with <p> for the html (no edit) output straight from MySQL, but it doesn't seem to work. It appears those symbols do not exist coming out of MySQL.

 

But after the text has been pulling into a textarea for editting, when I do the replace of \r\n\r\n with <p>, it works out fine when I refeed the content to the same webpage.

 

What are the symbols for the paragraph and newline breaks coming out of MySQL, if they aren't \r\n, etc.?

 

Humbly Yours,

 

Chris

 

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.