#!C:\Program Files\Perl\bin\perl.exe -w package spyTech; do 'header.pl'; print start_html("Search"); print <
HTML
if (param()) {
my $query = "SELECT * FROM product WHERE true";
if (param('id') ne "") { $query .= " AND \"id\" = " . param('id'); }
if (param('title') ne "") { $query .= " AND UPPER(\"title\") LIKE '%" . uc(param('title')) . "%'"; }
if (param('description') ne "") { $query .= " AND UPPER(\"description\") LIKE '%" . uc(param('description')) . "%'"; }
if (param('manufacturer') ne "") { $query .= " AND UPPER(\"manufacturer\") LIKE '%" . uc(param('manufacturer')) . "%'"; }
if (param('stock') ne "") { $query .= " AND \"stock\" = " . param('stock'); }
if (param('price') ne "") { $query .= " AND \"price\" = " . param('price'); }
$query .= " ORDER BY " . param('orderby');
$dbh = DBI->connect("DBI:PgPP:dbname=$dbName;host=localhost", "$dbUser", "$dbPass") or die "Unable to connect to localhost because $DBI::errstr";
$sth = $dbh->prepare($query) or die "Couldn't prepare statement: " . $dbh->errstr;
$sth->execute or die "Couldn't execute statement: " . $sth->errstr;
print "
|