A database driven website is a website that has most of its webpage content in a database. Therefore, the website content isn't actually sitting in files on the server, it is sitting in tables and columns in a database.
A website with its content stored on the file system is often referred to as a static website, whereas a database driven website is often referred to as a dynamic.
Content Management Systems
A website with dynamic content usually has a CMS (Content Management System) to assist the content providers in updating the website.
A CMS is usually provided in the form of an administration area where content providers need to log in before they can add content. Once logged in, they can create, update and delete articles. They may be able to upload files such as Word documents, PDF files etc. They might be able to upload images too.
All of this content can be stored in the database. Some may be stored on the file system too though. For example, although documents and images can be stored in the database, there are sometimes reasons to store them on the file system. Performance is often a key reason. Database size is another.
Discussion Forums and Blogs
Discussion forums and blogs have become a popular feature for many websites. Most, if not all, forums and blogs are database driven. Users can register their details, then add content. When the user clicks the "Submit" button, their details/content is inserted into the database. Then when someone decides to view this content, it is read from the database using SQL (Structured Query Language).
Combination of Static and Dynamic
Some websites have a combination of static content and dynamic content. There could be any number of reasons for this. Often, smaller websites will be static. There's little need to configure a database just to store a handful of webpages - much easier and cheaper to keep them as files on the server. Even websites like this might contain some added functionality such as a discussion forum, or a blog. In this case, the discussion forum or blog will need its content stored in a database.
Benefits of a Database Driven Website
Database driven websites can provide much more functionality than a static site can. Extended functionality could include:
- Enabling many (potentially non-technical) users to provide content for the website. Users can publish articles on the website without needing to FTP them to a web server.
- Shopping cart
- You can provide advanced search functionality that enables users to filter the results based on a given field. They can then sort those results by a field - say "Price" or "Date".
- Customized homepage
- You can allow your users to perform tasks such as registering for a newsletter, post questions to your forums, provide comments on a blog, update their profile, etc.
- Integration with corporate applications such as CRM systems, HR systems etc
- Much more
Creating a Database Driven Website
The most common tasks for database driven websites is inserting, updating, and deleting data. Some of these are the same tasks that you learned in this tutorial, however when using a database driven website, you need to use a different method to do these tasks. You need to use a programming language called SQL (Structured Query Language) to insert, update, and delete your data.
Don't worry, this is not as scary as it may sound. SQL is a very easy language to learn and, once you start using it, you will be thankful you took the time to learn it. In fact, you've already learned some basic SQL statements in previous lessons.
To create a database driven website, you need the following skills:
- You need to be able to write basic code using a server side scripting language such as PHP, ColdFusion etc
- You need to know how to write basic SQL
- You need to be able to design/build a database. If you need to learn about databases but missed the start of this tutorial, here it is :)
If you're familiar with PHP or ColdFusion, check out how to connect to and query a database in each of these technologies.