MySQL is an open source database and is included with many hosting plans. In this lesson, and for most of the rest of the lessons, we will store information in the database and write SQL queries to pull data from the database and use PHP to display it. The MySQL manual and documentation can be found at http://dev.mysql.com/doc/.
Start by logging in to your web hosting account and create a database. You will need to know the name of the database, the user name, the server, and your password. This will probably be displayed at the time you create the database.
Create a folder called data and copy all of these files to that folder, changing the file names from *.txt to *.php: index, query, showTable, data, and connection. The file connection has a function called connect. In this file provide the necessary information:
if(!function_exists("connect")) {
function connect() {
$database="";
$server="";
$user="";
$password="";
$msg="We cannot access our files at this time, please try later.";
$conn = mysql_connect($server,$user,$password)
or die ('I cannot connect to the database because: ' . mysql_error());
$db=mysql_select_db($database,$conn)
or die ('I cannot connect to the database because: ' . mysql_error());
}}//connect
Note: For instructional purposes we have called the variable $password, but you should use some other name for the variable. If a hacker gains access to you computer they will search for words like "password", "account", etc. Also, for security reasons, you should password protect the entire data folder. You do not want someone on the internet to stumble across this folder and mess up your database. In fact, you probably shouldn't name the folder data. Some boring name like Florida2003 sounds like a bunch of family photos and is less likely to draw attention.
At this point it may be difficult to understand the code in all of these files. If you create the folder with all of these files you will be able to create a couple of tables and experiment with those tables before you create a table of your own.