", $foo); $foobar2 = eregi_replace("%%ITALIC", "", $foobar); $barfoo = eregi_replace("%ITALIC;", "", $foobar2); $barfoo2 = eregi_replace("%ITALIC", "", $barfoo); $blortfoo = eregi_replace("%eacute;", "é", $barfoo2); $blortfoo2 = eregi_replace("%lt;", "<", $blortfoo); $blortfoo3 = eregi_replace("%gt;", ">", $blortfoo2); $blortfoo4 = eregi_replace("%amp;", "&", $blortfoo3); $farble = eregi_replace("%plus;", "+", $blortfoo4); $finalCellContents = stripslashes($farble); switch ($colname) { case name_id: $name_id = $finalCellContents; $client_id = $name_id; break; case role: $role = $finalCellContents; break; case new_name_variants: $name_variants = $finalCellContents; $new_name_variants = ereg_replace(";","
",$name_variants); if (!$finalCellContents) { $husbandFlag = 0; } else { $husbandFlag = 1; $allNameVariants = $row[$i]; $positionOfFirstSemiColon = strpos($allNameVariants,';'); if (! $positionOfFirstSemiColon) { $positionOfFirstSemiColon = strlen($allNameVariants); } $firstNameVariant = substr($allNameVariants,0,$positionOfFirstSemiColon); if (ereg("Miss ",$firstNameVariant)) { $husbandFlag = 0; } else { $name_heading = "$firstNameVariant"; } } break; case prefix: if (!$husbandFlag) { $name_heading = "$finalCellContents "; } break; case first_name: $first_name = $finalCellContents; if ($husbandFlag && $row[$i]) { $name_heading .= " ($finalCellContents"; $firstNameFlag = 1; } else { $firstNameFlag = 0; $first_name = $finalCellContents; $name_heading .= " $finalCellContents "; } break; case middle_name: $middle_name = $finalCellContents; break; case maiden_name: $maiden_name = $finalCellContents; if ($husbandFlag && $row[$i]) { $name_heading .= " $finalCellContents) "; } else if ($firstNameFlag) { $name_heading .= ") "; } break; case last_name: if (!$husbandFlag) { $name_heading .= " $finalCellContents"; } $last_name = $finalCellContents; break; case related_family_members: $related_family_members = $finalCellContents; break; case source_of_income: $source_of_income = $finalCellContents; break; case street_address: // The ; is my delimeter to be used during split/explode, // where the string is split into an array, since there // can be more than one address per person // (this goes for city and state as well): $street_addresses .= ";$finalCellContents"; break; case city: $cities .= ";$finalCellContents"; break; case state: $states .= ";$finalCellContents"; break; } } } $streetAddressArray = explode(";", substr($street_addresses,1)); $citiesArray = explode(";", substr($cities,1)); $statesArray = explode(";", substr($states,1)); echo "

$name_heading

$role

First Name:

$first_name

Middle Name:

$middle_name

Last Name:

$last_name

Maiden Name:

$maiden_name

Name Variants:

$new_name_variants

Relatives:

$related_family_members

Source of Income: $source_of_income

"; echo "

Address(es):

"; $numAddresses = sizeof($citiesArray); if ($streetAddressArray[0] == "" && $citiesAddressArray[0] == "" && $statesAddressArray[0] == "") { echo "[none]"; } else { for ($i = 0; $i < $numAddresses; $i++) { echo " $streetAddressArray[$i], $citiesArray[$i], $statesArray[$i]
"; } } echo "

"; // If there are no corresponding letter or transactions by this // person, we need no link: // $transactionContent = ""; if ($transactionFlag) { $transactionContent = "

Transactions made by:

$name_heading

"; } ##02/15: changed the file to go to from CorresSpecial_db to CorrespSpecialSenders_db## $correspContent = ""; if ($correspFlag) { $correspContent = "

Correspondence by:

$name_heading
"; } $measureContent = ""; if ($measureFlag) { $measureContent = "

Measurements for:

$name_heading
"; } echo "
$transactionContent $correspContent $measureContent "; } } #### end of function display_sql_results #### ## End of all functions ## ########################################################################################### ## Begin body of script ## getSQL(); // ************** // // First do an advance check for correspondence and transactions: // $myNameID = $record; if (strlen($myNameID) == 1) $myNameID = "00" . $myNameID; if (strlen($myNameID) == 2) $myNameID = "0" . $myNameID; $myNameID = "C" . $myNameID; // $measureCheckQuery = "SELECT * FROM measure WHERE name_id='$myNameID'"; $resultTmp = runSQLQuery($measureCheckQuery); if ($resultTmp) { $rowsTmp = mysql_num_rows ($resultTmp); if ($rowsTmp > 0) { $measureFlag = 1; } } $correspCheckQuery = "SELECT * FROM corresp WHERE from_id='$myNameID' ORDER BY date_for_sorting, date, letter_id"; $resultTmp = runSQLQuery($correspCheckQuery); if ($resultTmp) { $rowsTmp = mysql_num_rows ($resultTmp); if ($rowsTmp > 0) { $correspFlag = 1; } } $transactionCheckQuery = "SELECT ledger.ledger_id, client, name_id, year, month, day, cost FROM ledger, transz WHERE name_id = '$myNameID' and ledger.ledger_id = transz.ledger_id ORDER BY year, month, day"; $resultTmp = runSQLQuery($transactionCheckQuery); if ($resultTmp) { $rowsTmp = mysql_num_rows ($resultTmp); if ($rowsTmp > 0) { $transactionFlag = 1; } } // ************** // // Now back to our regularly scheduled programming, folks! ## $record is passed on the URL by the user, on an HREF, or through ## another script, e.g.: ## http://mama.stg.brown.edu/projects/tirocchi/database/people_db.php3?record=5 $field = "people_id"; if (preg_match("/P.*$/",$record)) { if ($record == "P001") $record = "595"; if ($record == "P002") $record = "596"; if ($record == "P003") $record = "597"; if ($record == "P004") $record = "598"; if ($record == "P005") $record = "599"; if ($record == "P006") $record = "600"; if ($record == "P008") $record = "602"; if ($record == "P009") $record = "603"; if ($record == "P010") $record = "604"; if ($record == "P011") $record = "605"; } $query = "SELECT people.name_id, role, new_name_variants, prefix, first_name, middle_name, last_name, maiden_name, related_family_members, source_of_income, street_address, city, state, address_order FROM people, address WHERE address.name_id = people.name_id and $field='$record'"; if ($query) { // Execute the SQL query here and display the results $result = runSQLQuery($query); if ($result) { $rows = mysql_num_rows ($result); if (! $rows) { $query = "SELECT people.name_id, role, prefix, first_name, middle_name, last_name, maiden_name, new_name_variants, related_family_members, source_of_income FROM people WHERE $field='$record'"; if ($query) { // Execute the SQL query here and display the results $result = runSQLQuery($query); if ($result) { display_sql_results ($result, $query, $card); } } } else { display_sql_results ($result, $query, $card); } } else { err_msg ("MySQL Error", "MySQL Error"); echo "\t

Query = ", $query, "

\n"; $query = ""; } } #################################################################################### ?>
0) { echo " << "; } ?> Browse People Records >> "; } ?> Clients   |   Employees   |   Family