Hello,
How about doing this:

my @cols = qw(firstname lastname title phone email age location address
address2 city state zip zip2 inst school_type grades_taught subjectarea_1
subjectarea_2 subjectarea_3 subjectarea_4 subjectarea_5 subjectarea_6
how_heard Occupation);

my $dbh = DBI->connect(.....);
my $keys = join ',', @cols;
my $vals = '?,' x $#cols . '?';
my $sth = $dbh->prepare("insert into $DB_TABLE ($keys) values ($vals)");

# now preceed as usual
my @rows;
while(<FILEHANDLE>){
   chomp;
   $sth->execute(split/\|/);
}

Hope this helps,,,

Aziz,,,


> while(<ThisFile>)
>  {
> chomp;
> my
> ($id,$firstname,$lastname,$title,$phone,$email,$age,$location,$address,$addr
> ess2,$city,$state,$zip,$zip2,$inst,$school_type,$grades_taught,$subjectarea_
> 1,$subjectarea_2,$subjectarea_3,$subjectarea_4,$subjectarea_5,$subjectarea_6
> ,$how_heard,$Occupation)  = split(/\|/,$_);
> 
> 
>  my $SQL_UP = qq`
>   Insert into $DB_Table
> (firstname,lastname,title,phone,email,age,location,address,address2,city,sta
> te,zip,zip2,inst,school_type,grades_taught,subjectarea_1,subjectarea_2,subje
> ctarea_3,subjectarea_4,subjectarea_5,subjectarea_6,how_heard,Occupation)
> 
>   Values
> ($firstname,$lastname,$title,$phone,$email,$age,$location,$address,$address2
> ,$city,$state,$zip,$zip2,$inst,$school_type,$grades_taught,$subjectarea_1,$s
> ubjectarea_2,$subjectarea_3,$subjectarea_4,$subjectarea_5,$subjectarea_6,$ho
> w_heard,$Occupation)`;
> 
>  my $sth= "$SQL_UP";
>  $str= $dbh->quote($sth);
>  print $str;
>  exit;

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to