Page 1 of 1

question about how to store data

Posted: Sun Aug 15, 2004 10:10 pm
by neophyte
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

Posted: Sun Aug 15, 2004 10:44 pm
by Sevengraff
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.

Blob

Posted: Mon Aug 16, 2004 6:05 am
by neophyte
Blob question is another good point. What would you use?

In this case their is likely only to be a handful of users who will be adding articles.

Posted: Mon Aug 16, 2004 6:21 am
by vigge89
i store my sites contents in text-fields, and the text is saved as the user inputted, all formatting is done when it's displayed (using bb-code formatting).

Posted: Wed Aug 18, 2004 10:51 am
by Black Unicorn
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

Posted: Wed Aug 18, 2004 11:18 am
by feyd
BLOB is the same size as TEXT, 64K..

text

Posted: Wed Aug 18, 2004 4:44 pm
by neophyte
Text seems to be the best option for storing the data. So the question is can anybody recommend a good gpl bb-code class. I was thinking of snagging the one that comes with phpBB. Any ideas?

Posted: Wed Aug 18, 2004 4:47 pm
by feyd
evilwalrus also has several.. they aren't the greatest, but a good place to start your own from..