Database Manager Tutorial - Samples
For the below examples, we'll gather information on family members, the data
we will be gathering is :
First Name
Last Name
Street Address
City
State
ZIP code
Age
The first step is to go to the database administration module which is located
in the /database directory on your account. Simply point a browser to it and log in.
In the 'Database Management' form, type your database name into the empty box (let's
call it 'family' in this case) and click the 'Create New' button.
The next screen asks us for a 'Field Name', where we enter the first field name,
in this case 'firstname' (no spaces in field names). Select the 'Text' Field Type from the drop down menu
and click the 'Add Field' button.
Repeat this process for lastname, address,city,state and zip. Since none of these fields should take up more than 128 characters, we don't need to touch the 'Length' drop down menus for those fields.
When creating the 'age' field, select the 'Numeric' Field Type and click the 'Add Field' button once again.
Since this is the last field, you may now click the 'I'm done - Create New Database' button.
We've just created a new database format which tells the software what information we are collecting
and what format the fields are in.
Step two is to enter the information into our database. This can be done using any database
software you have on your PC (just export it to text format, with the | character as the field separator).
You can also use a plain text editor (such as Notepad under Windows). When using a text editor, we would use the below format (one record/family member per line) :
First Name|Last Name|Street Address|City|State|Zip Code|Age
A real example could be :
John|Doe|1234 Hope Road|Paradise|Florida|33984|23
The above line would create an entry for the below family member :
John Doe
1234 Hope Road
Paradise, Florida 33984
Age 23
The information for each family member goes on it's own line, so info for two family
members would take the below format :
John|Doe|1234 Hope Road|Paradise|Florida|33984|23
Jane|Smith|5678 Main Street|Large Ville|Texas|87475|40
Now, we need to import our database information into the software. This is
done using the database administration module, located under the /database
directory under your account. Simply point your browser to it and log in.
Select the database name ('family' in this case) and the 'Import/Overwrite' option
from the drop-down menu. Click the 'Ok' button
Upload your database information as described on the next page.
Now we're ready to play. Two examples will be given below. Both examples will
require that a set of template files is created. So, let's start with that :
First we create a (this is optional) header file. Anything included in this .html
file will be shown at the top of each page the online database software results create. An example
could be :
<HTML><BODY><TITLE>My Family Info</TITLE>
<CENTER>Family Information</CENTER><HR>
|
|
This filename for this file needs to be (in our example) family.header.html
The footer file will be kept simple in this example :
This file (in this example, see the 'Using' documentation for more info) needs to be called 'family.footer.html'.
Now we need to tell the web based database software how to output the results. We'll keep this example
easy by creating just one database result template file, it could take the below format :
[family.firstname] [family.lastname]<BR>
[family.address]<BR>
[family.city], [family.state] [family.zip]<BR>
Age : [family.age]<P>
|
|
This filename needs to be called 'family1.html'.
Now, upload all of the template files (family.header.html, family.footer.html and family1.html)
to the database/templates subdirectory under your account.
Our first actual database project will simply list all the database entries on one page. To do this,
we'll create a .html file called 'list.html' (this can have any name) and enter the below in it. Quite a bit was left
out for this example, but the below would work. We're just trying to keep it simple for now.
<FORM METHOD="POST" ACTION="/cgi-domain/database">
<INPUT TYPE="hidden" NAME="database1" VALUE="family">
<INPUT TYPE="hidden" NAME="template" VALUE="family">
<INPUT TYPE="hidden" NAME="command" VALUE="list">
<INPUT TYPE="submit" VALUE="Show up to 10 family members">
</FORM>
|
|
For more information on what each those lines does, check the 'Usage' part of the
documentation. This sample would create a page with a button on it which reads 'Show up to 10 family members' and that is
exactly what it would do.
If this seems confusing, be sure to read all parts of the documentation and actually create the files for this
example and give it a try.
The part in red needs to be customized for your domain name.
The tutorial included in the script itself will provide exact/correct .html code
for use on your web site.
For our next database project, we'll create a file called 'search.html' which will create a database result page
for all family members over the age of 25 :
<FORM METHOD="POST" ACTION="/cgi-domain/database">
<INPUT TYPE="hidden" NAME="database1" VALUE="family">
<INPUT TYPE="hidden" NAME="template" VALUE="family">
<INPUT TYPE="hidden" NAME="command" VALUE="search">
<INPUT TYPE="hidden" NAME="searchfield1" VALUE="family.age">
<INPUT TYPE="hidden" NAME="searchvalue1" VALUE="25">
<INPUT TYPE="hidden" NAME="searchtype1" VALUE="greater">
<INPUT TYPE="submit" VALUE="Show family members over 25">
</FORM>
|
|
This page would show a button which reads 'Show family members over 25'. When clicked,
the database software would find family members over 25 years old and show their information only.
If this seems confusing, be sure to read all parts of the documentation and actually create the files for this project and give it a try.
The part in red needs to be customized for your domain name.
The tutorial included in the script will provide exact/correct .html code
for use on your web site.