|
HTMLTable - Create HTML table from DBI query output. |
HTMLTable - Create HTML table from DBI query output.
use DBIx::HTMLTable;
HTMLTable ($data, <options>);
HTMLTableByRef ($dataref, <options>);
HTMLTable() formats the results of a DBI query as a HTML table. The
first argument is the query output formatted as a multi-line string,
with columns delimited by a field separator (a comma by default) and
rows delimited by a record separator (newline by default). The second
argument is a hash of options and table attributes. Options and
attributes are described below.
&DBIx::HTMLTable::HTMLTable ($data,
{rs => "\n",
fs => ',',
caption => "Caption Text"});
HTMLTableByRef() takes as its first argument a reference to an array of
array references, as returned by DBI's fetchall_arrayref() and similar
functions. As with HTMLTable(), the second argument is a hash of valid
options and attributes.
$tableref = $dbh -> selectall_arrayref( "SELECT \* FROM $db" );
HTMLTableByRef ($tableref,
{bgcolor => 'white',
caption => "$db SELECT Query",
border => 2,
width => 300});
The file eg/tablequery.cgi is an example CGI script that formats query output for viewing in a Web browser.
Options determine how to interpret data and how to construct tables.
The following is a brief list of attributes that the HTML 4.0 <TABLE> tag recognizes. Refer to the HTML 4.0 specification (http://www.w3.org/) for detailed information about each attribute.
Version 0.24
Copyright © 2001-2004 Robert Kiesling, rkies@cpan.org.
Licensed using the same terms as Perl. Refer to the file, ``Artistic,'' for information.
Robert Kiesling, rkies@cpan.org
DBI(3)
|
HTMLTable - Create HTML table from DBI query output. |