in reply to Adding the values of a Hash to a MySQL Database
Well, you don't say what the problem is, but your SQL is incorrect, at least. Furthermore, you're setting your outer loop control variable, $i, to the result of your DBI call, which seems very odd. Try something like this (note, untested):
To explain: an insert statement takes a values clause, not a set clause. Also, the do statement in DBI allows you to use placeholders, which are much better for avoiding quotation problems.$dbh->do( "insert into Supersearch (ip, svr_name, port, service, banner) values (?, ?, ?, ?, ?)", undef, $i, $data{$i}{cname}, $j, $data{$i}{ports}{$j}{service}, $data{$i}{ports}{$j}{banner}) or die $dbh->errstr;
|
|---|