if ($state eq 'all' && $status eq 'all') {$query = '';} if ($state ne 'all' && $status eq 'all') {$query = "WHERE state='$state'"} if ($state eq 'all' && $status ne 'all') {$query = "WHERE approved='$status'"} if ($state ne 'all' && $status ne 'all') {$query = "WHERE state='$state' AND approved='$status'";} $statement = "SELECT id,state,city,discription,approval FROM speedtrap $query ORDER BY $sort1 $sortord"; $sth = $dbh->prepare($statement) or die "Couldn't prepare the query: ".$DBI::errstr; $rv = $sth->execute or die "Couldn't execute query: ".$dbh->errstr; print <

ID

State

City

Discription

Speed Trap Approval

Comment Approval

EOF while (@row = $sth->fetchrow_array) { ($id,$state,$city,$discription,$approval) = @row; print < $city $state $discription $approval $need comment approval? EOF } print ""; } $rc = $sth->finish; $rc = $dbh->disconnect;