i can't figure out what's wrong here. see the lines below # why doesn't this work. thanks
my (%tmp);
if ($in{'reunion'}) {
foreach $col (@db2_cols) {
if ($in{$col}) { $tmp{$col} = $in{$col}; }
}
$db2_key = $in{'Userid'};
my (%save_in) = %in;
# undef %in; commented because $tmp didn't work
&switch_to_register;
my %rec2 = &get_record2($db2_key);
if ($rec2{'Userid'}) {
# modify record
foreach $col (@db2_cols) {
# if ($tmp{$col}) { $rec2{$col} = $tmp{$col}; } # why doesn't this work
if ($in{$col}) { $rec2{$col} = $in{$col}; } # this works
}
$db2_key = $rec2{'Userid'};
$db2_key_pos = '1';
&modify_record2(%rec2);
}
#####
else {
# add record
$rec2{'Display'} = 'Yes';
$rec2{'Source'} = 'member';
foreach $col (@db2_cols) {
# if ($tmp{$col}) { $rec2{$col} = $tmp{$col}; } # why doesn't this work
if ($in{$col}) { $rec2{$col} = $in{$col}; } # this works
}
$db2_key = $rec2{'Userid'};
$db2_key_pos = '1';
&add_record2(%rec2);
}
%in = %save_in;
}
Code:
%rec = &get_record($in{$db_key}); my (%tmp);
if ($in{'reunion'}) {
foreach $col (@db2_cols) {
if ($in{$col}) { $tmp{$col} = $in{$col}; }
}
$db2_key = $in{'Userid'};
my (%save_in) = %in;
# undef %in; commented because $tmp didn't work
&switch_to_register;
my %rec2 = &get_record2($db2_key);
if ($rec2{'Userid'}) {
# modify record
foreach $col (@db2_cols) {
# if ($tmp{$col}) { $rec2{$col} = $tmp{$col}; } # why doesn't this work
if ($in{$col}) { $rec2{$col} = $in{$col}; } # this works
}
$db2_key = $rec2{'Userid'};
$db2_key_pos = '1';
&modify_record2(%rec2);
}
#####
else {
# add record
$rec2{'Display'} = 'Yes';
$rec2{'Source'} = 'member';
foreach $col (@db2_cols) {
# if ($tmp{$col}) { $rec2{$col} = $tmp{$col}; } # why doesn't this work
if ($in{$col}) { $rec2{$col} = $in{$col}; } # this works
}
$db2_key = $rec2{'Userid'};
$db2_key_pos = '1';
&add_record2(%rec2);
}
%in = %save_in;
}