create_dbZipCodes(); /* now add counties to the address of all Maine persons in the database * */ $every_person = getall_persons(); $allpersons = sizeof($every_person); $mainepersons = $countiesadded = 0; foreach ($every_person as $person) { if ($person->get_state() == "ME") { $mainepersons += 1; $countydata = false; if ($person->get_zip() != "") { $countydata = retrieve_dbZipCodes($person->get_zip(), ""); } else { if (!$countydata) { $countydata = retrieve_dbZipCodes("", $person->get_city()); } } if ($countydata) { $person->set_county($countydata[3]); update_dbPersons($person); $countiesadded += 1; } } } echo $allpersons . " persons processed<br>" . $mainepersons . " Maine persons processed<br>" . $countiesadded . " counties added\n"; /* include_once(dirname(__FILE__).'/dbPersons.php'); include_once(dirname(__FILE__).'/dbBookings.php'); include_once(dirname(__FILE__).'/dbLoaners.php'); $person = new Person("Smith", "John", "123 College Street","Brunswick", "ME", "04011", "2077291234", "",
function compute_county() { if ($this->state == "ME") { $countydata = false; if ($this->get_zip() != "") { $countydata = retrieve_dbZipCodes($this->get_zip(), ""); } else { if (!$countydata) { $countydata = retrieve_dbZipCodes("", $this->get_city()); } } if ($countydata) { if ($this->zip == "") { $this->zip = $countydata[0]; } return $countydata[3]; } } return ""; }