On Fri, Aug 09, 2002 at 11:32:38AM -0700, Gregg O'Donnell wrote:
> 
> Do I need to define "my $table ="

Um, yes.  There's nothing magical about how you're using $table, it's just
like using any other variable, which means you have to define it.  You could
also just insert "logger" directly into the SQL in place of $table.


> and if so, to the csv file?

No, to the table name you defined in the csv_tables structure.


> Also, the number of scalars should equal the number of question marks?

Yes.  You can read about placeholders in perldoc DBI.


> use DBI;
> 
> my $dbh = DBI->connect(qq{DBI:CSV:csv_sep_char=\\;});
> my $dbh->{'csv_tables'}->{'logger'} = { 'file' => 'logger.csv'};
> my $sth = $dbh->do("INSERT INTO $table VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", 
>undef, $name_logger, $phone_logger, $email_logger, $name_landowner, $phone_landowner, 
>$county, $logging_location, $logging_begin, $acres, $conf_number); 
> 
> my $sth->execute() or die "Cannot execute: " . $sth->errstr();
> my $sth->finish();
> my $dbh->disconnect();


Michael
--
Administrator                      www.shoebox.net
Programmer, System Administrator   www.gallanttech.com
--

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

Reply via email to