$sth = $dbh->prepare("SELECT password FROM table WHERE userName = '$userName'") or die $dbh->errstr; $result = $sth->execute(); print "There were no rows returned\n" if $result == 0;