Gossamer Forum
Home : Products : DBMan : Customization :

Append to 2nd DB using info from add form [update]

Quote Reply
Append to 2nd DB using info from add form [update] In reply to
Ok, so I've gotten this far. This code listed below will allow the updates and pulls the current information from the second database, but, instead of modifying the current information in the database it creates a new record with the same ID. How can change this code to modify the record rather than add a new one?

Code:
@db_cols = @tickets_cols;
$db_file_name = $tickets_db;
$in{'ID2'} = $rec{'Ticket'};
$ticket = $rec{'ID'};

open (DB, "<$db_file_name") or &cgierr("error in modify_records. unable to open db file: $db_file_name.\nReason: $!");
@lines = <DB>; # Slurp the database into @lines..
close DB;

$found = 0; # Make sure the record is in here!
LINE: foreach $line (@lines) {
if ($line =~ /^$/) { next LINE; } # Skip and Remove blank lines
if ($line =~ /^#/) { $output .= $line; next LINE; } # Comment Line
chomp ($line);
@data = &split_decode($line);

if ($data[$db_key_pos] eq $in{'ID2'}) {

%in = &get_record($in{'ID2'});
$in{'Work'} = $rec{'Work'} . "," . $ticket;
$in{'ModifyDate'} = &get_date;
$output .= &join_encode(%in);
$found = 1; } }

open (DB, ">>$db_file_name") or &cgierr("error in add_record. unable to open database: $db_file_name.\nReason: $!");
print DB $output;
close DB; # automatically removes file lock
@db_cols = @work_cols;
$db_file_name = $work_db;
Subject Author Views Date
Thread Append to 2nd DB using info from add form Helpdesk 2383 Jun 29, 2002, 10:54 PM
Thread Append to 2nd DB using info from add form [update]
Helpdesk 2275 Jul 4, 2002, 12:56 PM
Thread Re: [Helpdesk] Append to 2nd DB using info from add form [update]
LoisC 2281 Jul 4, 2002, 1:06 PM
Thread Re: [LoisC] Append to 2nd DB using info from add form [update]
Helpdesk 2271 Jul 4, 2002, 1:15 PM
Thread Re: [Helpdesk] Append to 2nd DB using info from add form [update]
LoisC 2279 Jul 4, 2002, 7:08 PM
Thread Re: [LoisC] Append to 2nd DB using info from add form [update]
Helpdesk 2277 Jul 4, 2002, 7:45 PM
Thread Re: Append to 2nd DB using info from add form [update]
Helpdesk 2253 Jul 8, 2002, 7:47 AM
Post Append to 2nd DB using info from add form [update]
Helpdesk 2230 Jul 22, 2002, 6:10 PM