prepare($sql); $sth->execute([$subnet_id]); $smarty->assign("subnet", $sth->fetch(PDO::FETCH_OBJ)); // locations for subnet $sql = "SELECT l.location_id, l.location_name FROM subnetlocation AS s LEFT JOIN location USING (location_id) WHERE s.subnet_id=? ORDER BY l.location_name"; $sth = $dbh->prepare($sql); $sth->execute([$subnet_id] $records = $sth->fetchAll(); $locations = array(); foreach ($records as $rec) { $locations[$rec['location_id']] = $rec['location_name']; } $smarty->assign("location_options", $locations); $smarty->display("subnetlocationdel.tpl"); include("footer.php"); ?>