CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: DBI:
problem with update in perl

 



vladinator
Novice

Dec 14, 2006, 8:59 PM

Post #1 of 3 (3358 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>";
}


}


davorg
Thaumaturge / Moderator

Jan 8, 2007, 7:31 AM

Post #2 of 3 (3333 views)
Re: [vladinator] problem with update in perl [In reply to] Can't Post

What errors are you getting?

--
Dave Cross, Perl Hacker, Trainer and Writer
http://www.dave.org.uk/
Get more help at Perl Monks


vladinator
Novice

Jan 8, 2007, 4:20 PM

Post #3 of 3 (3331 views)
Re: [davorg] problem with update in perl [In reply to] Can't Post

oh i was working on that project weeks ago its finished now dont worry

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives