I am using the following code in my .cgi progam (compiling with perl-5.8.6,
UNIX OS). It doesnt work. Could you please let me know what could be wrong?
I do not get any warnings/error messages/expected output. The .cgi and the
.csv are in the same directory.
Thanks,
Prakash
use warnings;
use DBI;
$dbh = DBI->connect("DBI:CSV:")
or die "Cannot connect: " . $DBI::errstr;
$dbh->{'csv_tables'}->{'info'} = { 'file' => *'testtable.csv'*};
$sth = $dbh->prepare("SELECT * FROM info")
or die "prepare: " . $dbh->errstr();;
$sth->execute()
or die "execute: " . $dbh->errstr();
while (my $row = $sth->fetchrow_hashref)
{
print("Found result row: id = ", $row->{'id'},", name = ",
$row->{'name'});
}
$sth->finish();
to work with *testtable.csv* file that contains just this:
name,id
DSA,123
I even modified the .csv file to have:
"name","id"
"DS",123