homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Code, Content, and Presentation / Databases
Forum Library, Charter, Moderator: open

Databases Forum

Storing text formatting

5+ Year Member

Msg#: 4416789 posted 1:21 pm on Feb 12, 2012 (gmt 0)

Hi folks,

I was struggling with storing and reproducing text formatting for a while there, more just the reperpoducing it again when echo'd to the screen.

I was putting;

This is
a line break

Into a text box, stashing it in the db, then when looked at in phpMyAdmin it read

This is
a line break

in the table view. I was alarmed I might be stashing lots of white space but someone then told me that phpMyAdmin was just being 'nice' and reformatting it for me which was quite annoying because it took me a while to figure out I needed 'nl2br' as I couldn't see any \n's in the database text. This now sorted tho, I noticed that with some forum software I use, their posts table contains all the posted messages with html inserted, they read like an html page when viewed in phpMyAdmin.

So, is there any particular considered good and bad practices as to how to store your text formatting, put html into the db, or just convert it by other means when you retrieve it, or is it merely a matter of taste?

The same friend told me he considered it better not to stash html in my tables, but didn't give any particular reason.


Global Options:
 top home search open messages active posts  

Home / Forums Index / Code, Content, and Presentation / Databases
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved