my $sth = $dbh->prepare("SELECT password FROM table WHERE userName = ?"); $sth->execute($username); if ($sth->selectrow_array){ print "logged in\n"; }