Help for this page

Select Code to Download


  1. or download this
    my $stmt = qq/INSERT INTO books ( / . join(',', keys %hash) . qq/) 
                    VALUES (/ . join(',', ('?') x keys %hash) . qq/)/;
    my $sth = $dbh->prepare($stmt);
    $sth->execute(values %hash);
    
  2. or download this
    sub write_to_db {
       my $table   = shift; #pass in table name
    ...
          $sth->execute(values %hash);   
       }
    }