if ($range eq "old") { $addressField = "oldAddressSort"; $streetField = "oldAddress"; } else { $addressField = "newAddressSort"; $streetField = "newAddress"; } # Allows the user to switch back and forth between old address (pre-1907) and new address (post-address) $queryaddress = "SELECT * FROM `addressMaster` WHERE $addressField = '$address' AND $streetField = '$street'"; my $sth = $dbh->prepare($queryaddress); $sth->execute(); ($oldStreetNumber,$newStreetNumber,$oldAddress,$newAddress,$oldAddressSort,$newAddressSort,$uida) = $sth->fetchrow(); # The above code simply finds the old and new street numbers and names for the indicated property if ($oldStreetNumber eq "") { $addressText = "No records found for this property."; $oldAddress = $street; $oldStreetNumber = $address; } else { $addressText = "Before 1907, this property was at $oldStreetNumber $oldAddress. It is now $newStreetNumber $newAddress." } $imageFileName = $newAddressSort . $newAddress; $imageFileName =~ tr/ //d; $imageFileName = $imageFileName . ".jpg"; $imageFileName =~ tr/A-Z/a-z/; # If we have a photo of the property from the 2000 AIC project, this will determine its name for subsequent display $query = "SELECT recordID FROM houseDocumentation WHERE address='$newStreetNumber' AND street='$newAddress'"; my $sth = $dbh->prepare($query); $sth->execute(); $xmlFile = $sth->fetchrow(); $sth->finish(); $housingSurveyStr = ""; if ($xmlFile) { $housingSurveyStr = "2000 Survey" } # If we have a 2000 AIC survey for the property, then build a link to a CGI program that will display it # I am skipping some code here, which simply builds up the headers to create a dynamic web page # Now iterate through the 4 data sources for demographic data (1883 and 1889 city directories, 1900 census, and 1916 phone book

1883 City Directory

EOF # I will repeat this code as many times as necessary to retrieve all the names of the people who lived or worked at this address. $querya = "SELECT * FROM `census` WHERE street = '$oldAddress' AND address = '$oldStreetNumber' AND source = '1883 City Directory' ORDER BY lastName, firstName"; my $sth = $dbh->prepare($querya); $sth->execute(); while (@ADDRESS = $sth->fetchrow()) { &getValues } print <

1889 City Directory

EOF $querya = "SELECT * FROM `census` WHERE street = '$oldAddress' AND address = '$oldStreetNumber' AND source = '1889 City Directory' ORDER BY lastName, firstName"; my $sth = $dbh->prepare($querya); $sth->execute(); while (@ADDRESS = $sth->fetchrow()) { &getValues } print <

1900 Census

EOF $querya = "SELECT * FROM `census` WHERE street = '$oldAddress' AND address = '$oldStreetNumber' AND source = '1900 Census' ORDER BY lastName, firstName"; my $sth = $dbh->prepare($querya); $sth->execute(); while (@ADDRESS = $sth->fetchrow()) { &getValues } print <

1916 Phone Book

EOF $querya = "SELECT * FROM `census` WHERE street = '$oldAddress' AND address = '$oldStreetNumber' AND source = '1916 Phone Book' ORDER BY lastName, firstName"; my $sth = $dbh->prepare($querya); $sth->execute(); while (@ADDRESS = $sth->fetchrow()) { &getValues } print <
EOF getFooter(); print "\n\n"; $dbh->disconnect; # The routine getValues retrieves individual records from the SQL SELECT statement above and formats them into HTML sub getValues { $address = $ADDRESS[0]; $aptNumber = $ADDRESS[1]; $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 (($address ne "") and ($street ne $oldAddress)) { $dispstreet = $street; $street =~ s/th//g; $street =~ s/ /%20/g; $address = "
Lived at: $address $dispstreet"; } else { $address = "" } if ($firstName ne "") { $nameOfPerson = $lastName . ", " . $firstName } else { $nameOfPerson = $lastName } $aptNumber =~ s/Room//g; if ($aptNumber ne "") { $nameOfPerson = $nameOfPerson . " Room " . $aptNumber } 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..." } # Builds a More… link that points to an external XML file, 1900Census.$recordID.xml. else { $recordID = "" } print < $nameOfPerson$occupation$r ecordID $address WOMBAT }