#!/usr/bin/perl use strict; use CGI; use DBI; my $msg; print "Content-type: text/html\n\n"; my $thanks = CGI::param('thanks'); if ($thanks == "true") { $msg = "Thank you for your order"; } my $dbdatabase = "aacaffeine"; my $dbserver = "localhost"; my $dbuser = "root"; my $dbpassword = ""; my $id = CGI::param('id'); my $dbh = DBI->connect("DBI:mysql:$dbdatabase:$dbserver", $dbuser, $dbpassword); my $query = "SELECT * FROM products ORDER BY productname"; my $sth = $dbh->prepare($query); $sth->execute(); my ($productname, $productdesc, $productprice, $productid); $sth->bind_columns(undef, \$productname, \$productdesc, \$productprice, \$productid); print "

$msg
\n"; while ($sth->fetch()) { print "\n"; } print "
$productname$productdesc$productpriceBuy
\n"; $sth->finish(); $dbh->disconnect();