|
AlbumDB
DescriptionAlbumDB
is an example of simple PHP scripts that make
entering data into the AlbumDB easier.
The scripts start with AlbumDB.cgi,
and then go to BandMembers.cgi,
Songs.cgi, and Summary.cgi.
These scripts are a bit messy, so I would look
at some of the other examples before trying to
tackle this one.
There are two include files, DBFunctions.inc
and VarFunctions.inc that contain functions
related to the database and passing variables between
scripts, repsectively.
I do this so I can reuse the functions, and because it
makes the main script code easier to read.
These are also written in PHP, but since they are included
in other scripts and do not run on their own, I use the
inc extension.
Everything you need to know about connecting to a
database and running queries with PHP is included
in this example.
A few technical notes that are not critical, but some may be
curious about.
You will notice that although I say these are PHP scripts,
they have a cgi extension. This is because it
allows me to run the scripts without the files being
world-readable, which is important so you cannot see the
"real" password for the database (in the DBFunctions.inc
file).
To convert back to regular PHP, you would rename the
files with the php extension, and take out
the first line in the file (#!/usr/local/bin/php).
You could also make them non-executable, since this
is not needed if they are not CGI.
|