joker851 Posted March 28, 2014 Share Posted March 28, 2014 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? Quote Link to comment https://forums.phpfreaks.com/topic/287375-storing-php-articles-in-databse/ Share on other sites More sharing options...
requinix Posted March 28, 2014 Share Posted March 28, 2014 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. Quote Link to comment https://forums.phpfreaks.com/topic/287375-storing-php-articles-in-databse/#findComment-1474356 Share on other sites More sharing options...
joker851 Posted March 28, 2014 Author Share Posted March 28, 2014 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. Quote Link to comment https://forums.phpfreaks.com/topic/287375-storing-php-articles-in-databse/#findComment-1474359 Share on other sites More sharing options...
requinix Posted March 28, 2014 Share Posted March 28, 2014 Excel helps you understand the tabular nature of data, but beyond that forget it. Real databases work differently and are actually capable of doing things like storing large amounts of data in a "cell". Quote Link to comment https://forums.phpfreaks.com/topic/287375-storing-php-articles-in-databse/#findComment-1474362 Share on other sites More sharing options...
joker851 Posted March 28, 2014 Author Share Posted March 28, 2014 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? Quote Link to comment https://forums.phpfreaks.com/topic/287375-storing-php-articles-in-databse/#findComment-1474365 Share on other sites More sharing options...
Psycho Posted March 29, 2014 Share Posted March 29, 2014 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 Quote Link to comment https://forums.phpfreaks.com/topic/287375-storing-php-articles-in-databse/#findComment-1474367 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.