in reply to Re: DBI::CSV using a variable to request columns
in thread DBI::CSV using a variable to request columns

I suspect my novice skills are beginning to show! I want the user, probably via a web based form, to be able to create a query e.g. select records from men infected with viral genotype a and display user defined results such as subject ID, gender, test group, viral dna levels etc (e.g. the columns)

I thought that I might display $queryResult in a web page.

  • Comment on Re^2: DBI::CSV using a variable to request columns

Replies are listed 'Best First'.
Re^3: DBI::CSV using a variable to request columns
by soonix (Chancellor) on May 20, 2016 at 19:51 UTC
    DBI can give you the column names, but only after the ->execute, you can find this e.g. in the doc's section on Statement Handle Attributes.
    I thought that I might display $queryResult in a web page.
    For this purpose, you could use HTML::Table::FromDatabase, which could replace your while loop with a simple call to
    my $table = HTML::Table::FromDatabase->new( -sth => $sth, -html => 'escape', -border => 1, ); print "<html><head><title>this is the page title</title></head><body>< +h1>this is the header</h1>"; print $table->getTable; print "this is the end</body></html>";

      Thank you, brother soonix. Your ontological knowledge knows no bounds. er.. have I gone to far with the whole Monastery/Anselmian stuff..

Re^3: DBI::CSV using a variable to request columns
by Corion (Patriarch) on May 20, 2016 at 20:00 UTC

      Thank you, Corion. That looks like a very useful module.