in reply to Perl Mysql Null Recordset

dws's solution works great if you only need to check if a user exists or not (although I'd use fetch() and $rs->[0] instead of fetchall_arrayref() and $rs->[0]->[0]). If you want to check if the user exists or not, and do something with the record if he does, try the following:

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

Replies are listed 'Best First'.
Re^2: Perl Mysql Null Recordset
by JoeJaz (Monk) on Nov 16, 2004 at 22:06 UTC
    Very nice way of putting it. That seems like it would give you more control over the variables inside the $rs1 if a user did exist. Thanks for the post. Joe