Skip to main content
added 45 characters in body
Source Link
kmkaplan
  • 19k
  • 4
  • 55
  • 65

Something like:

sub insertRow($$;$$$$)   { my $table = shift; my $placeholders = join(',', map { "?"; } @_); $dbh->do("INSERT INTO $table VALUES ($placeholders)", undef, @_); } 

Edited: you need to add undef as a parameter. Leon Timmermans suggests not using prototypes

Something like:

sub insertRow($$;$$$$) { my $table = shift; my $placeholders = join(',', map { "?"; } @_); $dbh->do("INSERT INTO $table VALUES ($placeholders)", undef, @_); } 

Edited: you need to add undef as a parameter.

Something like:

sub insertRow  { my $table = shift; my $placeholders = join(',', map { "?"; } @_); $dbh->do("INSERT INTO $table VALUES ($placeholders)", undef, @_); } 

Edited: you need to add undef as a parameter. Leon Timmermans suggests not using prototypes

Source Link
kmkaplan
  • 19k
  • 4
  • 55
  • 65

Something like:

sub insertRow($$;$$$$) { my $table = shift; my $placeholders = join(',', map { "?"; } @_); $dbh->do("INSERT INTO $table VALUES ($placeholders)", undef, @_); } 

Edited: you need to add undef as a parameter.