2004-09-22

PHP, MySQL and more

There's a number of websites I'd like to make, but have held off because it seemed like maintenance would be way too much trouble. For example, this list of C64 games licenced from movies I mentioned last post - wouldn't it be great if each entry could have it's own page with information on both the game and the original movie - screenshots, reviews, links to IMDB.com and a place to download the game, etc.? But once you have a web site with dozens or hundreds of pages, each hand-coded in HTML, imagine wanting to make a change to the header or footer - going through each page on by one? Yuck.

Server-Side Includes (SSI) helps somewhat. If your server supports it, you can make your web page header or footer (for example) in a seperate file. That file can then be referred to in your actual page, and the server automatically inserts it when someone wants to view the page. This means you can make a change in one of these included files, and all your pages that refer to it will automatically include the new version.

Still, this doesn't help with other issues you might have in a bigger (and growing) website. Each time I want to add a new game to my movie game database, for example, I'd have to take a template file and fill in all the data in a text editor. And if I needed to make a change to a particular entry, I'd have to scan through the whole html file, looking for the particular bit I want to change - potentially a hassle, if the page layout is quite involved. And if I wanted to make a change to the way the data is laid out? Forget it - that's why I haven't done it :)

So, PHP is a programming language that you imbed in regular HTML - it can take input from the URL (for example, go to google, do a search, and look at the url - anything after the ? is a parameter that the server is passing on to the program), it can perform string and numerical operations, and probably coolest of all, it can talk to a MySQL database.

MySQL is a free system that allows databases to be created, manipulated, and queried. I think I'll start my project by creating a database, and then created the PHP code just to simply read the database and display it, and put that online, so people can just look through the entries. Then I'll add searching and sorting features, and maybe eventually a way to update the site through the site.

But first things first - right now I'm studying all this stuff. The best tutorial I've found so far is here. I know my host for psw.ca has PHP and MySQL support, so I should be set. In fact, I've already got a few little PHP programs working - it's as easy as BASIC. On the MySQL side, I assume I'll have to install it locally on my Windows machine, and then upload the database I create to my website afterwards.


<< Home

This page is powered by Blogger. Isn't yours?