in reply to manipulating data array into returning nice message
But, you don't know if each delete was successful, so you'd have to keep track of that too. In fact, that would give you the chance to count (and report) both the successful and the failed deletes.
Something like this:
my @to_delete = $q->param('forum'); my ( @failed, @deleted ); local $dbh->{RaiseError} = 1; # so we get exceptions for errors foreach my $id (@to_delete) { eval { $dbh->do( q{ delete from mx_forums where id=? }, {}, $id ); push @successful, $id; }; push @failed, $id if $@; } # ...
|
|---|