Help for this page

Select Code to Download


  1. or download this
    #### or with placeholders:
    my $col_spec = join ',', keys %data;
    ...
    my $sql      = "insert into my_table ($col_spec) values ($val_spec)";
    
    $dbh->prepare($sql)->execute(@data{keys %data});
    
  2. or download this
    #### or with placeholders:
    my(@col_names, $sth);
    ...
        my $sql      = "insert into my_table (@col_names) values ($val_spe
    +c)";
        $sth = $dbh->prepare($sql);
    }
    
  3. or download this
    $sth->execute(@data{@col_names});