<%args> $pua_id $parent_id $new_member_id <%once> use DBI; <%init> my $dbh = DBI->connect('dbi:Pg:dbname=pua', 'pua', 'pua') or die "Couldn't connect to database: " . DBI->errstr; my $sth = $dbh->prepare("SELECT max(group_entry_id) from group_entry;"); $sth->execute or die "Execute failed: " . $sth->errstr; my $new_group_id = $sth->fetchrow_array(); $new_group_id++; $sth = $dbh->prepare("INSERT into group_entry(parent_contact_id, child_contact_id, group_entry_id) values($parent_id, $new_member_id, $new_group_id);"); $sth->execute or die "Execute failed: " . $sth->errstr; $m->comp('pua_contacts.html', edit => 't', contact_id => $parent_id, pua_id => $pua_id);