my $sth = $dbh->prepare("SELECT * FROM patrons WHERE patron_id=$patron_id"); $sth -> execute();
# check to see if record is in database
if (my $ref = $sth->fetchrow_hashref()) {
# update record
print "Updating $name_f $name_l\n";
$dbh->do("UPDATE patrons SET name_f=$name_f, name_l=$name_l, email=$email, discipline_id=$disc_id, rank_id=$status, username=$un");
}
else {
# insert new record
print "Inserting $name_f $name_l\n";
$dbh->do("INSERT INTO patrons (patron_id, name_f, name_l, email, discipline_id, username, password, can_contact, rank_id, template_id) VALUES ($patron_id, $name_f, $name_l, $email, $discipline_id, $un, $pwd, '1', $status, $template_id);
# join patrons to respective disciple default lists
# bib_databases
my $sth2 = $dbh->prepare("SELECT bib_database_id FROM items4DisBibdatabases WHERE discipline_id=$disc_id");
$sth2 -> execute();
while (my $ref2 = $sth2->fetchrow_hashref()) {
****** NEED TO use each bib_database_id ****** how do I reference it? with $_ or something else?
}
Thanks, Tim
-- Tim McGeary [EMAIL PROTECTED]
-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>