$taTable = $activeTables->getUniqueMatchingName('Tas'); // do the query $rows = $db->query("select Email, Fulltime, PartTime from {$taTable} order by Email"); $i = 0; $tas = ""; foreach ($rows as $key => $row) { $ta = Ta::fromRow($row); // checking whether proposed TA is in the list already if ($ta->email == $email) { $new = false; } $tas[$i] = $ta; $i = $i + 1; } $nTas = $i; print "<p>Active assignment table: {$taTable} with {$nTas} Tas.</p>"; if ($new) { print "<p>New TA will be added: {$email}</p>\n"; $ta = Ta::fresh(); $ta->email = $email; $ta->fullTime = 1; $ta->partTime = 0; $ta->addToDb($db, $taTable); } else { print "<p>Proposed TA is already in our list: {$email}</p>\n"; } $student->printSummary(); print "<br>\n"; } print '</article>' . "\n"; include "app/views/admin/footer.php";