Chapter 2 Lab
A CGI Script that Connects to a Database and Dumps One of Its Tables
Files You Need for this Lab
that elicits a file name
that dumps the named file to the browser
standalone Perl program
that connects to the Nile database and displays the contents of the title table
Tasks to Do for this Lab
Modify the form so that it asks for the name of a database rather than the name of a file.
Combine the CGI script and perl program so that the CGI script connects to the database specified by the modified form and dumps the contents of the table named "title".
Change the form's ACTION attribute so that it calls your edited CGI script.
Ensure that each row of the table is displayed on a separate line of the browser. (Hint: use the <PRE> tag or CGI.pm's
method instead of the three-step prepare/execute/finish sequence, e.g.
$rv = $dbh->do( "SQL STATEMENT" );
Returns only a return value, not a statement handle.
Not available in all DBD implementations.
Extra for Experts
Make the output look better by drawing a box around it.
Hint: put it in a bordered table.
Wednesday, 31-Oct-2001 14:17:45 CST
Copyright © 2006
Dan Keller Technical Services
4500 19th St., San Francisco
California, USA 94114
tel: 415 / 861-4500