
vladinator
Novice
Dec 14, 2006, 8:59 PM
Post #1 of 3
(6836 views)
|
problem with update in perl
|
Can't Post
|
|
I am having problems with this function The input values print out fine, but update statement wont work for some reason plz help &insert_DB($db_con,@buf); sub insert_DB() { my $dbh1=shift; my @buf=@_; for (my $i = 0; $i <=7; $i++) { my @pairs = split(/=/, $buf[$i]); my $config_group_id = $pairs[1]; print "'$pairs[0]'<br>"; print "'$pairs[1]'<br>"; if ($i >= 1) { my $sth = $dbh1->prepare(" UPDATE zBOT_Configuration SET config_name = '$pairs[0]', config_value = '$pairs[1]' WHERE config_group_id = $config_group_id and config_var_id = $i"); $sth->execute() || print $sth->errstr; $dbh1->commit; } } my $stm = $dbh1->prepare ( qq ( select * from zBOT_Configuration )); $stm->execute(); my @configs = (); while (my @rows = $stm->fetchrow_array()) { push (@configs,@rows); } foreach my $z(@configs) { print "$z<br>"; } }
|