####
#Create an instance of the CGI object
$cgiobject = new CGI;
#Output HTML header to the Web Browser
print $cgiobject -> header;
#Grab values submitted by the user
my $product=$cgiobject ->param("list");
$dbh=DBI->connect("dbi:mysql:$userdb:$dbserveraddy","$username","$password")
or die "Connection error: $DBI::errstr\n";
#Define MYSQL query - i think this is where I need assistance
$sql = "Select * FROM ?";
$sth=$dbh->prepare($sql);
$sth->execute($product) || #ERROR HERE
die "Could not execute SQL statement... maybe invalid syntax?";
print "";
#fetch each row and print results - also need assistance with this if its wrong
while (@results = $sth->fetchrow_array())
{
foreach $result (@results){
if ($result eq $results) {
print "| $results |
";
}
}
}
print "
";
$sth->finish;
$dbh->disconnect;