#!/usr/bin/perl print "Content-type: text/html\n\n"; use CGI qw(:standard -debug); use strict; use DBI; #declare variables my ($key, @sysletter, $systems, $dbh, $dsn); my $row = param('row'); my $action = param('action'); my $value = param('value'); #assign initialization string username and password to variables my $dsn = "DBI:mysql:IST221"; my $user_name = "ist221student"; my $password = "password"; my $dbh = DBI->connect($dsn, $user_name, $password); #preparing and executing the statement. if ($action eq "v") { my $sth = $dbh ->prepare("SELECT * FROM products order by pname"); $sth->execute(); print "\n"; print "
| Product | U/I | Quantiy | Cost |
|---|---|---|---|
| $row[1] | $row[2] | $row[3]); printf " | %.2f |