# All variables were initialized earlier sub printMenu { $letter =~ s/%20/ /g; # Put in a space instead of HTTP’s %20 entity $str = "WHERE lastName LIKE '$letter%'"; # Lets me build a SQL SELECT statement to only look at records beginning with letter $letter if ($letter eq '0') { $str = ""; $letter = "ALL RECORDS"; } print "Content-type: text/html\n\n"; print < $stylesheetlink View House History Records by Name. A B C D E F G H I J K L M N O P Q R S T U V W X Y Z ALL

Names

EOFILE $count = 0; # Pulls in the $str variable to fill in the limiting letter. This SELECT statement calls the records themselves from the census table. $query = "SELECT * FROM census $str ORDER BY lastName, firstName"; my $sth = $dbh->prepare($query); $sth->execute(); while (@ADDRESS = $sth->fetchrow()) { $address = $ADDRESS[0]; $aptNumber = $ADDRESS[1]; $dispstreet = $street = $ADDRESS[2]; $lastName = $ADDRESS[3]; $firstName = $ADDRESS[4]; $occupation = $ADDRESS[5]; $ownOrBoard = $ADDRESS[6]; $recordID = $ADDRESS[7]; $source = $ADDRESS[8]; $uid = $ADDRESS[8]; } if ($firstName ne "") { $nameOfPerson = $lastName . ", " . $firstName } else { $nameOfPerson = $lastName } $count++; $dispstreet =~ s/th//g; if ($ownOrBoard eq "R") { $ownOrBoard = "Primary Renter." } elsif ($ownOrBoard eq "B") { $ownOrBoard = "Boarder." } elsif ($ownOrBoard eq "U") { $ownOrBoard = "" } if ($source eq "1900 Census") { $recordID = "More..." } else { $recordID = "" } # This is the code that actually prints the names and addresses on the screen… print < WOMBAT } print "
$nameOfPerson $address $street $occupation ($source) $recordID
\n"; getFooter(); $dbh->disconnect; print "\n\n";