Jump to content

database text


mr_badger

Recommended Posts

well as long as you use textarea you can use nl2br() to insert it into the database and then when you retrieve it, it should remain the same

 

EG

$text = nl2br($text);

 

Hope it helps  ;D

 

~ Chocopi

Don't use nl2br when you insert text into the database. Only use nl2br when you go to display the text to the page. The database will preserve whitespace characters (newlines). The browser ignores whitespace characters that is why when you print text will newlines in it shows it as just one line. When you use nl2br it converts the whitespace newline chars into a HTML line break (<br />).

Link to comment
https://forums.phpfreaks.com/topic/55598-database-text/#findComment-274774
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.