NAME
HTMLTable - Make a HTML table from DBI query output.
SYNOPSIS
use DBIx::HTMLTable;
&DBIx::HTMLTable::HTMLTable ($data, <options>);
&DBIx::HTMLTable::HTMLTableByRef ($dataref, <options>);
DESCRIPTION
The HTMLTable function takes the results of a DBI query and formats it as an HTML table. The second argument is a hash of options and table attributes. Options and attributes are described below.
&DBI::HTMLTable::HTMLTable ($data,
{rs => "\n",
fs => ',',
caption => "Caption Text"});
HTMLTable uses 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).
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" );
&DBI::HTMLTable::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
Options are used to determine how to interpret data and how to construct tables.
- rs
-
HTMLTable only. Character delimiter for data rows.
- fs
-
HTMLTable only. Character delimiter for data columns.
-
If the value of this option is a non-empty string, formats the string as the table's caption.
TABLE ATTRIBUTES
The following is a brief list of attributes that the HTML 4.0 <TABLE> tag recognizes. Refer to the HTML 4.0 specification from the WWW Consortium (http://www.w3.org/) for detailed information about each attribute.
- align
- width
- cols
- id
- class
- dir
- title
- style
- onclick
- ondbclick
- onmousedown
- onmouseup
- onmouseover
- onmousemove
- onmouseout
- onkeypress
- onkeydown
- onkeyup
- bgcolor
- frame
- rules
- border
- cellspacing
- cellpadding
VERSION
Version 0.21 Mon Aug 26 08:41:04 EDT 2002
AUTHOR
Robert Allan Kiesling <rkiesling@earthlink.net