Link to home
Start Free TrialLog in
Avatar of djose
djose

asked on

Export/Import CSV file to Unix DBM database online using cgi programming

I need to create a webpage using cgi programming to build an admin. tool so that the user can import/export a csv file into a Unix DBM database to update it.

Thank you.
Avatar of teamatomic
teamatomic

you need to look at a perl module, DBD::CSV, it might work for what you want
Avatar of djose

ASKER

I have already written a code in perl to export the dbm filet to csv.....still can't figure out how to import the csv file into the dbm.  Can someone write the code for me or give a sample....How much points is that worth?
ASKER CERTIFIED SOLUTION
Avatar of pagemastah
pagemastah

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of djose

ASKER

Thanks for the suggestion, here is the sample code:

@WriteOrder = ("data1","data2");

     # Define location of datafile
     
     $DataFile = $ENV{"DOCUMENT_ROOT"} . "/data/" . $query->param("ReferenceNumber") . ".csv";

     # Write the data to file
     open (DATAFILE, ">>$DataFile");
     foreach $Field (@WriteOrder) {
          @Values=$query->param($Field);
          $Value=join("\|",@Values);
          $Value=~s/\"//g;    
          print DATAFILE "\"$Value\",";
     }
     print DATAFILE "\n";
     close (DATAFILE);