Send Feedback Print
Email ArticleConsidering a Database Driven Site?
by Chris Beasley
Maintaining and adding to a website can be a lot of work, certain things like server side includes can lessen the work, but what can make your job even easier is making your website database driven. If you store all of your content in a database you can access it from any page on your site by typing in just a few lines of code, you can sort it and display lists of it automatically. If your site is an article site and you have a separate page for each article, totaling a few hundred pages, you could instead enter the articles in a database, make less than 10 template pages, and greatly lessen your workload from then on.
There are many database solutions out there, but they have 3 standard components:
- a database backend
- a server side scripting language as the frontend
- SQL as the bridge between them
Your database backend will often differ depending on what you can afford and what your needs are. If you are working in a Unix/Linux environment you will most likely use MySQL, which is a free database for that platform. If you wish to work on NT/2000 you will most likely use Access or MS SQL Server, Access is a component of Microsoft Office, and MS SQL Server is more expensive and is a separate database application.Though these choices are what you will most likely deal with, they do not constitute your only choices, you can use Oracle or Sybase, or you could use Access on Unix and MySQL on NT. However, the choices outlined above are probably going to be the ones you find offered by most web hosting companies.
Your frontend will be a server side scripting language. There are 3 main choices for this. ASP is a creation of Microsoft and comes with NT/2000. It is the oldest of the languages as well. Some people will tell you that ASP is not actually a language, and this is true, however the average webmaster should just be concerned with the fact that out-of-the-box it is very similar to Visual Basic Script so if you have experience in that ASP may be the language of choice. However in my personal opinion I found ASP the hardest to learn.
Another choice is PHP which is a free open source scripting language made for the Unix/Linux platform, however it is now also possible to install it on NT/2000. PHP has only been around for a few years but it is growing widely in acceptance. One thing that hurts its growth is that it doesn't have a corporation backing it, big businesses like to know that if something goes wrong there is someone they can call. PHP is similar in a lot of ways to Perl and is fairly easy to learn.
The third choice, and focus of the following article, is Cold Fusion. Cold Fusion was developed as a commercial product by the Allaire Corporation. It started out for only NT but has since been released for other platforms as well, it has also recently been made available in a free version. Cold Fusion is fairly popular for big business websites, however for the rest of us it really hasn't caught on as much. This is probably due to the cost of it, which can run into the thousands of dollars. However when dealing with a hosting company you'll find that an NT server with Cold Fusion installed is only around $10 more a month than a Unix server with MySQL and PHP. There is also a large help base for Cold Fusion at the Allaire website, including many free custom tags or scripts. One thing that is different about Cold Fusion as compared to the others is that you can encrypt your scripts and have them still work, so if you're a developer who wishes to develop and sell Cold Fusion scripts this added security is beneficial. Cold Fusion is very similar to HTML in that it uses tags, and also I found it the easiest of the three to learn.
Tie Them Together
So, you have your backend, you have your frontend, then you just need SQL to bridge the gap. SQL stands for Structured Query Language it is a way of talking to a database and is pretty much standard across all vendors. SQL is also covered in this article.
Though you have all of the above choices to make, you should know that whatever you choose it will work the same way. A browser sends a request to your web server for a CFM (Cold Fusion Markup) document. The server recognizes the .cfm extension and sends the request to the Interpreter. Each language has an interpreter, and that is what does the work. The interpreter will read the document, if there is a database request in it then it will query the database, get the requested information, automatically generate the HTML, and then send the completed document to the browser.
Now you should have a basic understanding of how everything works. Next week we'll learn the basics of Cold Fusion.