Date sent:              Thu, 17 May 2001 10:39:29 -0400 (EDT)
From:                   Joe Grastara <[EMAIL PROTECTED]>
To:                     Ray Cuzzart II <[EMAIL PROTECTED]>
Copies to:              [EMAIL PROTECTED]
Subject:                Re: Help with INSERT INTO table VALUES @array

Ray, 


> > $dbh = DBI->connect("DBI:mysql:$db",$servuser,$servpass) or die "Unable to
> > connect to inventory database: $dbh->errstr\n";

$dbh->errstr is not a variable but method call, thus it will not 
interpolate. Say

$dbh = DBI->connect("DBI:mysql:$db",$servuser,$servpass) or die 
"Unable to connect to inventory database: " . $dbh->errstr . "\n";


> > my $obj = new CGI;
> > my @values = map { $obj->param($_) } $obj->param();
> > my @all = join(",", @values);

join() joins the elements of an array into a string, so it is not 
clear to me what @all does here

> > foreach (@all) {s/addvehicle,//;}

I guess this should read

for (@values) { s/addvehicle,//; }


> > my $all = "@all";

and here you should

my @all = join ', ', @values;

> > my $success = $dbh->do("INSERT INTO $tbl VALUES $all") or die "Unable to
> > write information to inventory database: $dbh->errstr\n";

and here:

my $success = $dbh->do("INSERT INTO $tbl VALUES ($all)") or die 
"Unable to write information to inventory database: " . $dbh->errstr 
. "\n";

> > 
> > $dbh->disconnect;
> > 

confirm that $tbl has a useful value

HTH

Bodo
[EMAIL PROTECTED]

Reply via email to