my $dir='../admin/'; my $table='EVENTS'; my $dbh= DBI->connect("DBI:CSV:f_dir=$dir")or die "Cannot connect: " . $DBI::errstr; #if the table does not exist, make it #since we are using DBD:CSV, I am not sure that the field type/size declarations #are necessary, or even applied. Including them will make the code more portable if #we move to mysql in the future. if (! -e "$dir$table") { print "making table $dir$table"; my $sth= $dbh->prepare ("CREATE TABLE $table (ukey CHAR(20), city CHAR(45), date CHAR(10), time CHAR(8), title CHAR(64), location CHAR(250), contact CHAR(64), email CHAR(60), phone CHAR(14) type CHAR(1))") or die "Cannot prepare: " . $dbh->errstr(); $sth->execute() or die "Cannot execute: " . $sth->errstr(); } my $sth=$dbh->prepare(qq{INSERT INTO $table VALUES (?,?,?,?,?,?,?,?,?,?)}) or die "Cannot prepare: " . $dbh->errstr(); $sth->execute(@fieldvals) or die "Cannot execute: " . $sth->errstr();