if($c->param("searchTerm")) { while ($row = $q->fetchrow_hashref) { my $bgc = ($i % 2 == 0) ? 'background:#DDD;' : ''; $results .= qq! $row->{SerialNumber} $row->{AssetTag} $row->{AssetType} $row->{Branch} $row->{Status} $row->{Comments}
!; $i++; } } } else { $results .= "No results matched your asset query."; } #### #!perl use DBI; use CGI; my $assetTag = param('AssetTag'); print "Content-Type: text/html\n\n"; $head = <<'HEAD'; Inventory Edit HEAD $tail = <<'TAIL'; TAIL $body = <<'BODY';

Branch Inventory Edit

This page allows you to edit the Branch Inventory.

Asset Tag
SerialNumber
AssetType
Branch
Status
BODY results = <<'RESULTS';
RESULTS $i = 0; $c = new CGI(); $field = $c->param("field"); $field =~ s/'/\\'/; $h = DBI->connect("dbi:mysql:inventory:localhost","ID","PW") or die("couldn’t connect to database"); $query = "SELECT SerialNumber, AssetTag, AssetType, Branch, Status, FROM inv WHERE AssetTag = $AssetTag"; $q = $h->prepare($query); %columns = ( SerialNumber => "Serial Number", AssetTag => "Asset Tag", AssetType => "Asset Type", Branch => "Branch", Status => "Status", ); $results .= ""; $h->disconnect(); $results .= <<'RESULTS';
RESULTS print $head; print $body; print $results; print $tail;