我创建了数据库标头作为散列的键,并尝试将散列值(数据类型:数组)插入 mysql 数据库。但它给出了语法错误。以下是代码,请建议做什么???
my @keys = keys %hash; #keys used as database headers
my @values=values %hash; #value to be inserted
my $sth=$dbh->prepare("INSERT INTO `$table`(@keys) VALUES (@values)");
$sth->execute() or die "ERROR writing to database: $DBI::errstr $dbh->errstr";
这是哈希(使用 Data::Dumper)
$VAR1 = bless( { '120493acNo' => [ '1' ], 'a120064amount' => [ '133' ], '120310amount' => [ '23' ]}, 'CGI' );