my $stmt= "SELECT * FROM users WHERE $searchfield = ? ORDER BY ? ASC"; my $sth = $dbh->prepare($stmt); $sth->execute($searchterm, $searchfield);