banner

Introduction to Database Driven Development, PHP and MySQL

Written by

Author: Adam Knife
Introduction to Database Driven Development PHP and MySQL
PHP is one of the “scripting languages” of the Web. It is an interpreted language, interpreted by the official PHP interpreter, developed specifically for web programming. Being quite similar to ASP in many ways, chances are a change from ASP to PHP would not be all that difficult for a seasoned developer who was experienced in a C-style language.

PHP, combined with Apache, or another web server handles all the “standard” web serving side of development; it watches for requests, it hands them off to the appropriate handlers, it sends the required headers, and it finalizes the job.

On it’s own, PHP is a language capable of many simple things: date functions, file manipulation, mathematics, logic, all the traditional programming language stuff (including some very feature-filled mechanics for topics such as string manipulation and date manipulation) – but it doesn’t expand in to the power given by database driven web applications. Luckily, there are standard libraries such as the MySQL library, which allow you to easily integrate databases in to your project.

A database is simply that, a collection of data. MySQL is both a relational database server, and query language. It allows users to easily create tables of information, which are sortable by a number of columns, and capable of handling millions of rows of information. Rather impressive when you look at it’s simplicity.

MySQL (pronounced My Sequel) is an implementation of the popular SQL – “structured query language” – don’t worry if you’ve never heard of SQL before – we’ll get there in a later lesson. Information can be stored in a SQL database, and accessed in a range of different ways, manipulated, modified, and stored rapidly.

But wait, why the heck do we want to store our content in a database? Why not just store it in flat files? That’s an easy question. If by flat files, you mean storing it in plain text files and loading it in to a PHP-powered templating system – the database is faster. If by flat files, you mean storing it in HTML files and linking them around, you’ve probably already answered your own question. HTML-only websites are messy, frequently ending up with hundreds of files, each with their own copy of the template, among other things. A simple change for an HTML-only site could take days to implement, where in a PHP-MySQL-powered site it would take minutes.

On top of that, by integrating PHP + MySQL in to your project you open a range of new uses. In the future you could set up a web-service for a software application to contact your database server and get the content, you could sell your database of content, or you could further manipulate the way the content is stored.

The advantages to a database driven, scripting language powered site are numerous, and you shall realize them more and more as you get deeper in to web development.

About the Author:
Adam X. Knife is a professional web developer and author of the new Code Hippo programming “blog”-style site. When he’s not writing articles on programming, or developing code himself, he’s reviewing laptops or MP3 Players.[divider]

Article Categories:
SQL

Leave a Comment

Your email address will not be published. Required fields are marked *


*

captcha

Please enter the CAPTCHA text