$rs1 = $db1->prepare("SELECT ..."); $rs1->execute(...); unless ($row = $rs1->fetch())) { die("User does not exist\n"); } ... check supplied password against the one in $row ...