Logo Your Web Hosting Solution
Line
Database Docs:
Introduction
Administration
Usage
Samples
Tutorials Index
Web Hosting
Database Manager Tutorial - Usage

1. Getting Started

Regardless of database command used, the below lines are needed to initiate a database request.

<FORM METHOD="POST" ACTION="/cgi-domain/database">

The above line simply tells your form to use the database script. The part in red needs to be customized for your domain name.

The tutorial included in the software will provide exact/correct .html code for use on your web site.

<INPUT TYPE="hidden" NAME="database1" VALUE="clients">

This line tells the script that the first (and maybe the only) database we wish to open is called 'clients'. Up to 5 database can be opened at one time. To open two databases, you'd use

<INPUT TYPE="hidden" NAME="database1" VALUE="clients">
<INPUT TYPE="hidden" NAME="database2" VALUE="clients2">
The first databased opened would be 'clients', the second would be 'clients2'.

<INPUT TYPE="hidden" NAME="start1" VALUE="1">

This line tells the script where to start reading our first database. In this case, we start with entry/record one. This line can be omitted, the script will simply start with the first database entry.

If you wanted to start with the last entry (to show never entries first), you could enter the last record number (if you know what it is), or simply use VALUE="last".

<INPUT TYPE="hidden" NAME="loadorder1" VALUE="regular">

This line tells the script which order to read database 1 in. The above line would read it top to bottom.

<INPUT TYPE="hidden" NAME="loadorder1" VALUE="reverse">

This line would make the script read the database bottom to top. This line is optional. If this line is not included, the script will load the data in the "regular" order.

<INPUT TYPE="hidden" NAME="perpage" VALUE="10">

The above lines tells the online database manager software to display 10 results per page. This line is optional. If left out, it will default to 10 results per page. If you wish for all possible results to be shown on one page, use VALUE="all".

<INPUT TYPE="hidden" NAME="template" VALUE="mytemplate">

This specifies the output template to be used. Template files are basically .html files and need to be uploaded/stored in the database/templates/ directory on your main web directory.

The output templates control the look/layout of the result pages created by the database script. In this example, our template is called 'mytemplate'.

Templates have can have various elements. When the database software outputs results, it starts by showing the content of the template header file.

This file requires filename mytemplate.header.html (replace mytemplate with the actual name of your template). This part is displayed on the top of the page, above any actual database record output.

Next, actual database results are shown. You have full control over how this is done. You control the look/layout. For the first result, the scripts will show template file mytemplate1.html (again, replace mytemplate with the name of your template), next mytemplate2.html and so on. If you have ten results per page and only mytemplate1.html and mytemplate2.html, the script will use mytemplate1.html for the first result, mytemplate2.html for the second, then go to back to mytemplate1.html for the third and so on.

These files are basic .html files in which you can incorporate database fields found to match your query. For example, you could place the below .html code in one of these files :

Customer Name : [clients.name]<BR>
Customer Address : [clients.address]<P>

The above (as long as that database record matches your query) will output the above text and replace the entry between the square brackets as follows :

[database-name.field-name]

So, in our above case, the database name is 'clients', the fields we're using are 'name' and 'address'. Output would then look something like (for example)

Customer Name : Fred Flintstone
Customer Address : Bedrock

Lastly, when creating output, the script will display the footer files, which need to have a filename of mytemplate.footer.html (replace mytemplate with the actual name of your template). This part is displayed below any actual database record output.

The footer file can have [back] and [next] buttons or links. To include these, simply type [back] (in the footer file) where you want the back button or link. Type [next] (in the footer file) where you want the back button or link. To create buttons, create a file called mytemplate.backbutton.html for the [back] button a file called mytemplate.nextbutton.html for the [next] button. These files should contain one (1) line of text only. Either :

<INPUT TYPE="submit" VALUE="Your Value Here">

or if you wanted to use a graphical button :

<INPUT TYPE="IMAGE" SRC="/image.gif" BORDER=0>

To include text links, create files called mytemplate.backlink.html and mytemplate.nextlink.html. These files can contain no more than one line of text. This text is the text which will be shown as the link people click on.

Please note that the [back] feature does not work for 'search' commands at this time (the [next] feature does).

An optional mytemplate.noresults.html template page can be used to display a message when no results are found in the database for a database request.

<INPUT TYPE="hidden" NAME="command" VALUE="list">

There are several 'commands' which can be performed by the database script. See the 'commands' chapter for more information.

A simple example would look something like :

<FORM METHOD="POST" ACTION="/cgi-domain/database">
<INPUT TYPE="hidden" NAME="command" VALUE="list">
<INPUT TYPE="hidden" NAME="perpage" VALUE="20">
<INPUT TYPE="hidden" NAME="template" VALUE="try">
<INPUT TYPE="hidden" NAME="database1" VALUE="testing">
<INPUT TYPE="hidden" NAME="start1" VALUE="last">
<INPUT TYPE="hidden" NAME="loadorder1" VALUE="reverse">
<INPUT TYPE="submit" VALUE="GO">
</FORM>
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.

2. Commands

A. The 'list' command

This 'command' will simply list database entries. Up to 5 database can be opened to list/read information from simultaneously.

B. The 'search' command

This 'command' will only display database results which match your the search criteria which you have defined. For each field to be compared, you need the below lines :

<INPUT TYPE="hidden" NAME="searchfield1" VALUE="database.field">
<INPUT TYPE="hidden" NAME="searchvalue1" VALUE="my-entry">
<INPUT TYPE="hidden" NAME="searchtype1" VALUE="search-type">

The first line tells the database management software which field to compare to your input.

The second line is the (user) input to compare to the database value. This data can be of the "hidden" type, or "text" entered by the user into a box, a drop down menu and so on.

The third line tells the script how to compare the user input and the database value for that field (more on this below).

To search on more than one field, repeat the above and replace searchfield1 by searchfield2 and so on.

Different types of database searches are possible, depending on the field type :

Text Fields
exactinput and database value must match exactly
exact.casesame as above but case sensitive
startwithdatabase value must start with user input
startwith.casesame as above but case sensitive
allall words in the input must appear in the database value
all.casesame as above but case sensitive
anyany word in the input matches the the database value
any.casesame as above but case sensitive
orsee below
or.casesame as below but case sensitive

The 'or' searchtype allows users to select from several possible values for the same searchfield. Say we have a database with a 'city' field and three different values for the city field (London, Paris, Rome). The below .html would take advantage of this feature (let's this is our second searchfield :

<INPUT TYPE="checkbox" NAME="searchvalue2-1" VALUE="London">
<INPUT TYPE="checkbox" NAME="searchvalue2-2" VALUE="Paris">
<INPUT TYPE="checkbox" NAME="searchvalue2-3" VALUE="Rome">

In short, you define searchvalue2 as usual, but add a hypen (-) and an increasing number for each possible value. You can have up to 100 values.

If users select both London and Rome, only database entries for those cities would show in the results. There is a shortcut allowing users to search all cities

<INPUT TYPE="checkbox" NAME="searchvalue2" VALUE="all">

Please note that the above has no '-' after searchvalue2.

Numeric & Index Fields
exactinput and database value must match exactly
rangedatabase value is in the range defined in the input
smallerdatabase value is smaller than the user input
greaterdatabase value is greater than the user input

To define a range (on the first field in the below example) :

<INPUT TYPE="hidden" NAME="searchvalue1" VALUE="0|100">

The above line defines a range from 0 to 100.

Or to use this feature from a drop down menu :

<SELECT NAME="searchvalue1">
<OPTION VALUE="0|100">0 - 100
<OPTION VALUE="100|500">100 - 500
<OPTION VALUE="500|1000">500 - 1000
</SELECT>

Date Fields
exactinput and database value must match exactly
rangedatabase value is in the range defined in the input
smallerdatabase value is smaller/earlier than input
greaterdatabase value is greater/later than input
selectsee below
select.rangesee below

To define a range (on the first field in the below example) :

<INPUT TYPE="hidden" NAME="searchvalue1" VALUE="02/31/2000|04/01/2000">

The above line defines a range of dates in March 2000.

Or to use this feature from a drop down menu :

<SELECT NAME="searchvalue1">
<OPTION VALUE="02/31/2000|04/01/2000">March 2000
<OPTION VALUE="03/31/2000|05"/01/2000>April 2000
<OPTION VALUE="04/31/2000|06/01/2000">May 2000
</SELECT>

The "select" option allows you to present the user with drop down menus for month, day and year.

The field names are to be defined as follows (this example is for a date field is also the first search field) :

FieldnamePurpose
searchday1day of month to be searched
searchmonth1month to be searched
searchyear1year for be searched

The "select.range" option allows you to present the user with drop down menus for day, month and year values (both start and stop times).

The field names are to be defined as follows (this example is for a date field which happens to be the first search field) :

FieldnamePurpose
startday1start day value (example : 22)
startmonth1start month value (example : 02)
startyear1start year value (example : 2001)
stopday1start day value (example : 29)
stopmonth1start month value (example : 09)
stopyear1start year value (example : 2002)

Time Fields
exactinput and database value must match exactly
rangedatabase value is in the range defined in the input
smallerdatabase value is smaller/earlier than input
greaterdatabase value is greater/later than input
selectsee below
select.rangesee below

To define a range (on the first field in the below example) :

<INPUT TYPE="hidden" NAME="searchvalue1" VALUE="11:59|13:00">

The above line defines a range anything from 12:00 - 12:59.

Or to use this feature from a drop down menu :

<SELECT NAME="searchvalue1">
<OPTION VALUE="02:59|04:00">3 AM
<OPTION VALUE="03:59|05:00">4 AM
<OPTION VALUE="04:59|06:00">5 AM
</SELECT>

The "select" option allows you to present the user with drop down menus for hour and minute.

The field names are to be defined as follows (this example is for a time field which happens to be the first search field) :

FieldnamePurpose
searchhour1hour to be searched
searchminuted1minute to be searched

The "select.range" option allows you to present the user with drop down menus for hour and minute (both start and stop times). The field names are to be defined as follows (this example is for a time field which happens to be the first search field) :

FieldnamePurpose
starthour1start hour (example : 13 for 1PM)
startminuted1start minute value (example : 50)
stophour1stop hour (example : 13 for 1PM)
stopminuted1stop minute value (example : 50)

Password Fields
exactinput and (encrypted) database value must match exactly

Boolean Fields
exactinput and database value must match exactly

C. The 'delete' command

As you may have guessed, this 'command' allows you to delete database records. Usage is exactly the same as the 'search' command (you would tell the software to use the 'delete' command from your .html code), which means you can remove mulitple records at once.

Please note that once data is removed, it can not be retrieved in any way. If you wish to test this command, build your page and set the 'command' to 'search'. Any records which show in the result page (set perpage to 'all') are the ones which would be removed.

Templates work the same way. The header and footer files are required, but not the templateX.html ones. So, if you do not wish to show the user which records were removed, you need not do so.

If you use this feature on your site, be sure to export your data frequently to have backups.

For added security, this feature can be password protected. Use the database manager (/database directory on your account) to set the removal password. Then in your .html code, add :

<INPUT TYPE="hidden" NAME="password" VALUE="enter-your-password-here">

The password in question must be the one for the first database opened when using more than one database at once.

If you do not create any passwords (if you create one, you must create all) in the database management software, people will be able to remove entries without any password.

Even with this added level of protection, it is a good idea to only place .html for removing records in a password protected directory for added security. People can view source on documents, this will add protection.

D. The 'add' command

This command allows you to add database records via a web form. Say you have a database called family and it's records contain three fields (name, address, phone), you would use the below .html (adding the required other .html code as always) :

<INPUT TYPE="text" NAME="family.name">
<INPUT TYPE="text" NAME="family.address">
<INPUT TYPE="text" NAME="family.phone">

In short, you use the same format you would in templates, databasename.fieldname.

For added security, this feature can be password protected. Use the database manager (/database directory on your account) to set the 'Add Records' password. Then in your .html code, add :

<INPUT TYPE="hidden" NAME="password" VALUE="enter-your-password-here">

The password in question must be the one for the first database file opened when using multiple databases at once.

If you do not create any passwords (if you create one, you must create all) in the database manager, people will be able to add entries without any password.

Even with this added level of protection, it is a good idea to only place .html for adding records in a password protected directory for added security. People can view source on documents, this will add protection.

E. The 'modify' command

This 'command' allows you to modify database records. Usage is exactly the same as the 'search' command (you would tell the software to use the 'delete' command from your .html code), which means you can modify multiple records at once. Please note that once data is modified the previous copy can not be retrieved in any way. If you wish to test this command, build your page and set the 'command' to 'search'. Any records which show in the result page (set perpage to 'all') are the ones which would be modified.

Templates work the same way. The header and footer files are required, but not the templateX.html ones. So, if you do not wish to show the user which records were removed, you need not do so.

If you use this feature on your site, be sure to export your data frequently to have backups.

For added security, this feature can be password protected. Use the database manager (/database directory on your account) to set the modification password. Then in your .html code, add :

<INPUT TYPE="hidden" NAME="password" VALUE="enter-your-password-here">

The password in question must be the one for the first database opened when using multiple databases at once.

If you do not create any passwords (if you create one, you must create all) in the database manager, people will be able to modify entries without any password.

Even with this added level of protection, it is a good idea to only place .html for modifying records in a password protected directory for added security. People can view source on documents, this will add protection.

Top Of Page 
Line
Copyright© 1996 - 2024 Clockwatchers, Inc.