Blog > Why you need a database
A great deal of websites use databases but what is the reason for this and why should your website use one?
Databases are an excellent way to store website information from order details to website text content. They are quick to retrieve data from and to search so are ideal for use in websites.
One of the main benefits to a client for opting to use a database with a website is to allow the client website administrator to easily and quickly manage the sites content through a content management system (CMS).
For example a website may have a news area. On the main page it could list all the news articles with a brief description and a link to the full article. It could also have a box on the homepage displaying the last five news articles. In a non-database driven website each time a news article was added the static HTML files would need to be accessed and amended with the new news item. This would mean manually updating the homepage box, the news list page and adding a new news article page. This process is very time consuming, is open to human error and would require technical expertise in editing the HTML files leading to a high cost for just adding one news item.
If a database is used then all the news details could be stored in it, which would allow the news to be managed through a CMS. By using a database the data is stored in one place only and therefore details such as the Title only have to be updated once in the CMS and the change is propagated throughout the website wherever that Title is displayed. In this case on the homepage, the news list page and the actual news page.
Due to a database being used the homepage box, news list page and individual news pages can be automatically populated from the database. This means that whenever a news item is added through the CMS it will appear on the homepage, the news list and as an individual news page without the administrator having to amend any code or website pages. All the administrator has to do is add the news item details through a form in the CMS.
This also makes editing and removing news entries easy through the CMS because the data is stored in one place in the database. It also opens up different ways the data could be used in the future, for example, creating a RSS feed of the news items.
The only downside to using a database in this manner is that it does cost more to setup. Although if editing is added to a CMS there would be no ongoing cost so it would save you money and time in the long run.
Some people make the mistake of going for the cheaper option of using static content rather than a database only to regret it later when then need to keep requesting changes to their website at a high cost to themselves.