Database Reference
In-Depth Information
WHERE name_last LIKE ?" ;
my $sth = $dbh-> prepare ($sql_stmnt);
$sth-> execute ( "%$search_parameter%" );
my $members = $sth-> fetchall_arrayref ();
$sth-> finish ();
print "List of Members - '$search_parameter' \n" ;
foreach my $member (@$members){
my ($human_id, $full_name, $membership_expiration) = @$member;
print "$full_name ($human_id) - $membership_expiration \n" ;
}
}
if ($human_id && $membership_expiration) {
$sth = $dbh-> prepare ($sql_stmnt);
$sql_stmnt = "UPDATE humans
SET membership_expiration = ?
WHERE human_id = ?" ;
$sth = $dbh-> prepare ($sql_stmnt);
my ($rc) = $sth-> execute ($email_address,$human_id);
$sth-> finish ();
if ($rc) {
print "Membership Expiration Changed. \n" ;
}
else {
print "Unable to change Membership Expiration. \n" ;
}
}
$dbh-> disconnect ();
exit ();
If this program is executed from the command line, adding the last name of the Hollar
after the name of the program, it will return the name of Lexi Hollar with her human_id
in parentheses, along with the date her membership expires. The following example
shows how a user might execute the program, and the results returned from running it
with this user value:
Search WWH ::




Custom Search