$team->fetchdets(); $hteam = new Histteam($Seas); $hteam->Name = $team->Name; $hteam->Description = $team->Description; $hteam->Division = $team->Division; $hteam->Playing = $team->Playing; $hteam->Sortrank = $team->get_scores($Pars); // Also sets Wonm etc $hteam->Playedm = $team->Playedm; $hteam->Wonm = $team->Wonm; $hteam->Drawnm = $team->Drawnm; $hteam->Lostm = $team->Lostm; $hteam->Wong = $team->Wong; $hteam->Drawng = $team->Drawng; $hteam->Lostg = $team->Lostg; $hteam->create(); // Create the members $membs = $team->list_members(); foreach ($membs as $memb) { $memb->fetchdets(); $hmemb = new HistteamMemb($hteam, $memb->First, $memb->Last); $hmemb->Rank = $memb->Rank; $hmemb->create(); } } // Now apply promotions and relegations for ($d = 1; $d < $ml; $d++) { $nd = $d + 1; if (isset($_POST["pd{$d}"])) { array_push($messages, "Promoted {$promo[$nd]->display_name()} from division {$nd} and relegated {$releg[$d]->display_name()} from division {$d}"); $promo[$nd]->updatediv($d);