Appendix: Database Software, Scripting Languages, and XML

Scripting Languages

Unfortunately, getting information into the database is only half the battle to using a database on a historical website. You now need to be able to extract bits of this information, format them, and insert them into web pages as visitors to your site make requests. The database software is merely interested in storing and serving this data and cannot do this task for you. Neither can HTML, which is a fairly “dumb” set of text tags. Instead, you must rely on one of several “scripting” languages that know how to communicate with the database software. “Scripts,” or little programs that you can place either inside the HTML pages you construct or in separate files linked to web pages, are processed on the fly by the web server and can fill a page with information from a database. There are as many scripting languages as databases, though you often see certain languages in combination with certain databases. For instance, one of Microsoft’s scripting languages, Active Server Pages (ASP), is generally used with other Microsoft products, including SQL Server. PHP (a self-referential acronym for PHP: Hypertext Preprocessor), the open source community’s answer to ASP, is most often used with the open source MySQL and PostgreSQL databases. In contrast, ColdFusion, a popular scripting system from Macromedia, can be found attached to a wide variety of databases.

The words “scripts” and “scripting” sound very humanities-like, but these languages are, for all intents and purposes, programming languages, meaning that they are more difficult to pick up than HTML and far less forgiving to human error. If you need scripts to access a database, you should consider hiring a programmer who knows one of these languages well. Go about designing and building your site without the materials from the database—leaving room in your design “templates” for those items —and then bring in a programmer for a day or two to write pieces of technical code that will add the database elements. A programmer who knows how to structure a database properly for your collection of historical items and how to write the scripts to place those items into your design templates should cost around $50-100 per hour (generally a minimum of $1,000 for a basic setup; complex websites like EllisIsland.org require weeks, if not months, of database and programming work).

Regardless of who does the technical work, you should start by outlining the specific “tables” for the information you want to store. Each table, similar to a spreadsheet in Excel, holds a particular kind of information—;for instance, a list of a historical organization’s members or the pieces of data about letters in an archive. Even without fully understanding database software, you can probably draft the fields of each table: last name, first name, membership renewal date, and so on, for a membership roll; author, date written, to whom the letter was sent, body of the text, and so on, for a letter. Once in the database, each of these fields will be searchable individually as well as in tandem with other fields. From this list of fields (or “columns”), you or your programmer can proceed to set up the framework of the database, into which specific records (also called “rows”) will go. Remember you (or your staff) will spend most of your time filling the database rather than creating it in the first place, but you should start by thinking about which fields to separate out; you will have trouble if you decide later that members’ last names should be in a separate field from their first names.

To be more specific, a historical society’s membership roll in a database might look as follows:

first_name last_name member_since dues
Charles Beard 1986 $75
Frederick Turner 1997 $75
Edward Gibbon 1999 $75

Programming code, in this case PHP embedded in regular HTML, pulls entries out of the database and formats them for a “membership roll” web page:

<html>

<head>

<title>Membership Roll</title>

</head>

<body>

<h1>Membership Roll</h1>

. . .

<?php

// print out today’s date

echo ‘Generated on ’ . date ("F jS, Y") . ‘<br><br>’;

// pull membership information out of the database

$result = mysql_query (“SELECT first_name, last_name, member_since FROM membership ORDER BY last_name”);

//format each member’s information

while ($row = mysql_fetch_assoc ($result)) {

echo $row[‘first_name’] . ‘ ‘ . $row[‘last_name’]. ‘ (member since ‘ . $row[‘member_since’] . ‘)<br>’;

}

?>

</body>

</html>

The web server processes the programming code when a user requests the page and creates a pure HTML document in a split second as follows:

<html>

<head>

<title>Membership Roll</title>

</head>

<body>

<h1>Membership Roll</h1>

Generated on July 4th, 2005<br><br>

Charles Beard (member since 1986)<br>

Edward Gibbon (member since 1999)<br>

Frederick Turner (member since 1997)<br>

</body>

</html>

And, unaware of the process that went into its rapid assembly, users see this in their web browser:

Membership Roll

Generated on July 4th, 2005

 

Charles Beard (member since 1986)

Edward Gibbon (member since 1999)

Frederick Turner (member since 1997)

Although institutional or ISP web hosts rarely provide access to database systems or allow web pages to include programming languages in addition to basic HTML, an increasing number of commercial web hosts provide such amenities. As of this writing, the most popular scripting language among web hosts is PHP, and the most popular database is MySQL. (Note the trend toward free and open source products; you will have more trouble finding a host that uses commercial scripting languages like ASP or ColdFusion, or commercial databases like Microsoft SQL Server.) Most web host comparison sites allow you to list just the companies that offer these more advanced services.7 If you have a small database or need modest scripting on your site, a commercial host can be a good choice, and they generally charge only a little bit more for these services than for basic HTML-only accounts. Decent web hosting with PHP and MySQL starts at around $10 per month with a single database. Many of these plans also offer access to bulletin board services for visitors to leave comments and engage in discussion about your site or the topic it covers.

7 For example, see Web Host Directory, ↪ link A.7.