Esempio n. 1
0
 public function updateScientificNames()
 {
     global $db;
     $query = "SELECT * FROM species WHERE Scientific_Name is NULL ORDER BY Taxon_ID";
     $result = $db->getall($query);
     foreach ($result as $r) {
         // Create taxon synonym object.
         $taxon = new Taxon($r["Taxon_ID"]);
         // Taxon_ID will be the identifier of the suggestion list.
         $taxon->setGenus(trim($r["Genus"]));
         $taxon->setSpecie(trim($r["Species"]));
         $taxon->setSpecieAuthor(trim($r["Species_Author"]));
         $taxon->setSubspecie(trim($r["Subsp"]));
         $taxon->setSubspecieAuthor($r["Subsp_Author"]);
         $taxon->setVariety(trim($r["Var"]));
         $taxon->setVarietyAuthor(trim($r["Var_Author"]));
         $taxon->setForm(trim($r["Form"]));
         $taxon->setFormAuthor(trim($r["Form_Author"]));
         $scientificName = $taxon->getScientificName(false, false);
         $queryUpdate = "UPDATE species SET Scientific_Name = '" . $scientificName . "' WHERE Taxon_ID = " . $taxon->getId();
         $db->Execute($queryUpdate);
         echo "UPDATED: <b>ID: " . $taxon->getId() . "</b> <i>" . $scientificName . "</i><br>";
     }
 }