Okay, I'm building a table to store data for articles to be displayed on my website. It's pretty much built with PHP and mysql. But before I start dumping data into it I have some questions about how/what type of data to store.
Do I store the article blob data with html tags in it? or no tags? Do I store them with html special characters already in place or do I add them later with htmlspecialchars() or htmlentities()?
Or... Is it best to store the data as a simple text string and add <p> tags and images when the article displays?
What say ye?
Thanks
question about how to store data
Moderator: General Moderators
- Sevengraff
- Forum Contributor
- Posts: 232
- Joined: Thu Apr 25, 2002 9:34 pm
- Location: California USA
- Contact:
what I do is store it as a text field, and keep the data exactly as it was entered by the user (except to add slashes where needed). Apply htmlspecialchars() and other formatting things before it is displayed.
are there advantages to storing it as blob? I have seen some other programs do this. I thought blob was just for binary stuff.
are there advantages to storing it as blob? I have seen some other programs do this. I thought blob was just for binary stuff.
-
Black Unicorn
- Forum Commoner
- Posts: 48
- Joined: Mon Jun 16, 2003 9:19 am
- Location: United Kingdom
BLOB is for binary objects, but can contain plaintext too.
I think though that the BLOB type can't hold as much text as a TEXT type. Most common use for BLOB types is storing images, audio or .doc files, which can be rendered later if your output proper MIME types before pasting the data into a document.
Happy dev'ing,
H
I think though that the BLOB type can't hold as much text as a TEXT type. Most common use for BLOB types is storing images, audio or .doc files, which can be rendered later if your output proper MIME types before pasting the data into a document.
Happy dev'ing,
H