Move your &Create_DB_Connection outside the loop (you only need to do it once. It looks as though you are fairly unfamiliar with DBI so here is a start. I just typed this out so there are probably typos/syntax errors.

#!/usr/bin/perl -w use strict; use CGI; use CGI::Carp('fatalsToBrowser'); use DBI; my $home = $ENV{HOME}; my $q = new CGI; # get rows to delete my @deletes = $q->param('delete_this_row'); # print a header using CGI.pm print $q->header(); # connect to database, only need to do once (fill in values) my $dbh = DBI->connect($data_source, $username, $auth, \%attr) or erro +r("Can't connect to database!"); # prepare and cache SQL - we use a placeholder ? ALWAYS USE ? placehol +ders! my $SQL="DELETE FROM timeclock WHERE oid = ?"; my $sth = $dbh->prepare_cached($SQL) or error("Could not prepare $SQL" +); # do the deletions my $results; foreach my $delete(@deletes) { $sth->execute($delete) or error("Could not execute $detete"); $results .= "<LI>Deleted $delete</LI>\n"; } # commit the changes $dbh->commit or do {$dbh->rollback; error("Could not commit changes")} +; $dbh->disconnect or error("Disconnect error"); sub error { my $error = shift; print "<h2>Database error!</h2>\n" print "<p>$error " . $DBI::errstr; exit; } ################ BEGIN PRINT RESULTS SUBROUTINE sub print_results{ print <<HTML; <HTML><HEAD><TITLE>Delete Entry</TITLE></HEAD> <BODY BGCOLOR="#FFFFFF"> <CENTER><FONT SIZE=6 FACE=ARIAL>Delete Results</FONT></CENTER> <HR WIDTH=80%> <P> <CENTER> <UL> $results </UL> </CENTER> <P> <HR WIDTH=80%> <P> <CENTER> <FONT SIZE=4 FACE=ARIAL> <a href="$home">Home</A> |<a href="in_form.cgi">Clock In</A> | <a + href="search_form.cgi">Search</A> </FONT> </CENTER> </BODY> </HTML> HTML } # End of print_results subroutine

Totally untested. See btrott for a basic guide to DBI and the DBI pod.

cheers

tachyon

s&&rsenoyhcatreve&&&s&n.+t&"$'$`$\"$\&"&ee&&y&srve&&d&&print


In reply to Re: Re: Re: Re: Re: Multiple Check boxes and Handling by tachyon
in thread Multiple Check boxes and Handling by nlafferty

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.