student has asked for the wisdom of the Perl Monks concerning the following question:
#!/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 "<HTML><FONT SIZE=15>\n"; print "<BODY><CENTER>\n"; print qq(<table width="70%" border="0" cellspacing="5" align="center"> +<tr><th>Product<th>U/I<th>Quantiy<th>Cost</tr>); while (my @row = $sth -> fetchrow_array()) { print qq(<tr><td>$row[1]<td align=center>$row[2] <td align=center>$row +[3]); printf "<td align=right>%.2f</tr><p>",$row[4]; } } elsif ($action eq "a") { print "Location: http://carrotcake.nsm.tridenttech.edu/tablefunction.c +gi\n\n"; } elsif ($action eq "u") { print "this is the update page under construction\n"; } elsif ($action eq "d") { print "this is the delete page under construction\n"; } else { print "Error!\n"; } print qq (</table>); print "<HTML><FONT SIZE=3>\n"; print "<A HREF='http://carrotcake.nsm.tridenttech.edu/dbhome.html'>\n" +; print "Return to Selection Page"; print "</HTML></FONT>\n";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Redirection question
by PodMaster (Abbot) on Nov 21, 2004 at 03:12 UTC | |
| |
|
Re: Redirection question
by duff (Parson) on Nov 21, 2004 at 03:19 UTC | |
|
Re: Redirection question
by nedals (Deacon) on Nov 21, 2004 at 08:18 UTC | |
|
Re: Redirection question
by chanio (Priest) on Nov 21, 2004 at 22:43 UTC |