Jump to content

Recommended Posts

I am trying to create a dynamic news site where people can write and post articles. However I'm not quite sure how and where to actually store the articles. Ideally what I would like to do is input the articles in a database but if the article is 1000 words long I'm not quite how it would be stored. So an example of the table could be: ID, Name, Article, Date, Time. Any ideas?

Link to comment
https://forums.phpfreaks.com/topic/287375-storing-php-articles-in-databse/
Share on other sites

Not sure why the length of the article is an issue...

 

It's a question of requirements. What all do you need? Not included in your list are things like tags/categories and authors - do you want those? The concept of authors (or it sounds for you like simply "users") means all sorts of fun things like users, passwords, permissions...

 

Though a suggestion: combine the date and time into one field. No sense keeping them separate.

No what I mean is how is a full article going to be stored in the database? For example if you have data such as username, author, password, category etc in the fields that is not a problem because that kind of information is only going to be short. No more 15 characters long generally but how can a full 1000 or 2000 word article be stored in one field of the database in the "article field"? For example you can put small bits of data in an excel spreadsheet and slighlty expand or contract the cells and it works fine but putting a whole article in one cell is not going to make for easy viewing.

I'm just using Excel as example but I'm actually using mysql. How would a long article appear in a mysql database? How can it be stored to you can still easily view the databse?

You are looking at it completely wrong. A database is not meant ot be viewed directly. Anything you use to "look" at the database is simply doing a query and outputting the data in some format. You know, you can store whole images in your database, but you aren't going to "see" an image if you were to inspect the contents. You would just see a string of random characters. It is when you retrieve the content and format it back as an image that it would be viewable as an image. Stop thinking of the database as an Excel document. As for storing data you simply choose the appropriate field type. For something that can be a very long article you would use the BLOB or TEXT types.

 

http://dev.mysql.com/doc/refman/5.0/en/blob.html

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.