$sth = $dbh->prepare ("SELECT count(*) FROM forbidden_usernames WHERE f_user LIKE ?"); $sth->execute($str); ($bad) = $sth->fetchrow_array; print "Bad username\n" if $bad;