Subscribe to our mailing list

* indicates required

Why Do I Need A Database?

Posted on May 15, 2001

by Dan Grossman

If you're not familiar with the term as it relates to the web, a database is a structured collection of data. It can be anything from a list of email addresses to a set of names, addresses and phone numbers.

Trellian SEO Toolkit - Optimize your website, Increase your traffic!

By far the most popular database management system is mySQL, because it is free, works well, and most web hosts have it installed. This can be used in conjunction with a language such as PHP or Cold Fusion to create a website which interacts with the database.

PHP is probably the most popular of languages for interacting with mySQL databases. It can be easily used to create webpages for your site dynamically. This means that, rather than a site consisting of many static or unchanging webpages, each page is generated based on information in your database, at the time the page is accessed by a user.

Creating a web site in a language such as PHP and using a database to store the information, or some of it, has many advantages over a normal static site. One of the most common and most useful ways to use a database in your website is in a content management system.

What Is It And How Does It Work?

A content management system is a set of programs (basically, webpages containing programming code) written in a language such as PHP. The content management system displays the content of your website to your visitors and allows you to easily add, edit or remove content from the site without creating a new webpage.

This is accomplished by storing the content of the site in a database. Rather than creating a "page1.html" with a layout, title, content, etc. you would store the title and content in the database, along with any other information you wanted like the author name, keywords, etc.

Then, rather than having a link to "page1.html" you'd have a URL that looked something like this:

Email Marketing

Article.php would be a page you've written in PHP which gets information from your database. The "?id=123" passes the fact that the user has clicked on a link to article number 123. The page would access your database, find article 123, and send back a webpage to your visitor with that article in the body. But, the difference between this and a static page is that you use the same webpage to access other information:

You're accessing the same article.php, but you've told it you want article 124, and a new page would be created and sent to you with article 124 in the body.

The content management system also would allow you to add, edit or remove content from your site without editing many webpages. You'd simply have separate pages setup which allow you to edit the information stored in the database.

Why Do I Want To Do This?

There are many reasons to use a database-driven content management system as opposed to many static webpages. Several are:

1. Easier To Change Site Design

With a database-driven site, there is really only one webpage. The content of the site is inserted into this page dynamically when it is requested based on information passed to the page (such as the article number).

This means changing the look of the entire site can be as easy as changing the HTML in that one page. The page would contain both HTML and programming code for whatever language you chose.

2. Easier To Update Your Site

Using a database-driven content system, you no longer have to create a separate webpage for each piece of content you want on your site. By setting up a form which submits information to add to your database, you can update the site just by copying and pasting a piece of content into the form, and adding it to the database. If you write the site to take articles based on date, for example, the new content could appear immediately on your site.

How Do I Create a Content Management System?

Here are several places you can learn about building a database- driven website, specifically with PHP and mySQL:


WebMonkey's PHP Programming section has many well-written articles and tutorials dealing with both PHP programming and interacting with mySQL. They even have a "PHP/mySQL Tutorial."


WebMonkey's Backend Databases section includes information about choosing a database system, an introduction to databases, several tutorials and more.


The Web Developer's Virtual Library has several good tutorials and information about the PHP language and how to use it in conjunction with mySQL databases.

There are many uses of databases in websites, and a content management system is just one of them. Hopefully this article has informed you on exactly what a database is and has provided you with several links to good starting points for those who are interested in using a database in their site.

Dan Grossman runs where you can find over 250 hand-picked resources, articles, and tools! Dan also publishes the free weekly "WebDevPortal" newsletter for website owners! Subscribe today and get articles like this every week:


blog comments powered by Disqus Domain Registrar, Marketplace and Revenue Optimizer