Hi all,
I have a web page I am working on to delete an entry out of a database. If I take the
syntax in the perl script and paste it into a mysql query, and substitute the variable
for a value that exists in the database, it will delete the entry. If I run it thru
the web page, I dont get an error, it says it worked ok and I get no errors. The
remove subroutine calls the removemac subroutine. Here is the code:
--- CODE ---
sub remove {
my $delmac;
print "<h3 align=center> Delete MAC </h3>";
print "<h4 align=center> Careful! Make sure you know what you are doing!
</h4>";
return <<FRM;
<center>
<form action="$self" method="post">
<input type="hidden" name="action" value="removemac">
MAC Address to remove: <input type="text" name="delmac">
<input type="submit" value="Delete MAC">
</form>
</center>
FRM
}
sub removemac {
my $user = param('delmac');
print $user;
my $query = "DELETE FROM passwd WHERE user_name=$user LIMIT 1";
my $sth = $dbh->prepare($query) || &db_err("Cannot prepare $query <P> \n
:" . $dbh->errstr . "\n");
$sth->execute || &db_err("Cannot execute $query <P> \n:" . $dbh->errstr
. "\n");
$sth->finish;
print "<h3 align=center> Deleted customer! </h3>";
print "<center<a href\"" . $self . "?action=\"> Go Back </a>";
}
--- CODE ---
Any help is appreciated.
Thanks,
Dave Kettmann
NetLogic
636-561-0680
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>