} else { if ($_POST['type'] == "delete") { try { $branch = new Branch($_POST['key']); $branch->delete(); } catch (fExpectedException $e) { echo $e->printMessage(); } } else { if ($_POST['type'] == "add") { try { $branch = new Branch(); $branch->populate(); $branch->store(); $theId = $branch->getId(); $ids = Inv_item::findIdUB($db); foreach ($ids as $id) { $stock = new Inv_stock(); $stock->setBranchId($theId); $stock->setItemId($id); $stock->setQuantity(0); $stock->store(); } } catch (fExpectedException $e) { echo $e->printMessage(); } } else { if ($_POST['type'] == "name") { $branch = new Branch($_POST['key']); echo $branch->prepareName(); }
<?php include './resources/init.php'; //Find all items $results = Inv_item::findIdUB($db); //$results = Inv_item::findAll(); foreach ($results as $result) { echo $result . " \n"; }