The purpose of this tutorial is to explain how to retrieve data from a
database and display that data on your webpage.
In this first slide, we list, at the beginning of our Perl program, the
calls on the CGI and DBI libraries, followed by the database parameters
(database name, server name, database user and password).
1. OUR FIRST DBI/PERL PROGRAM EXAMPLE:
#!/usr/bin/perl
MAIN:
{
use CGI;
use DBI;
$database="claywall";
$server="localhost";
$db_server=$server;
$user="root";
$password="04u2c_pixie!";
}
2. PROGRAM DESCRIPTION:
The first line is a reference to the PERL interpreter.
#!/usr/bin/perl
The second line and third lines open a block of statements labeled MAIN.
The fourth line calls the CGI (Common Gateway Interface) library
The fifth line calls the DBI (Database Interface) library.
The sixth line defines the database name.
The seventh and eighth lines define the server and database server
The nineth line defines the database user
The tenth line defines the database user password
The eleventh line closes the block.
|