in reply to compare two values in perl
my $usr = $dbh->prepare(q{SELECT user_id from user where user_id = ?} +) or die("usr prepare error: $!"); $usr->execute($user_name) or die("usr execute error: $!"); while (@row = $usr->fetchrow_array ) { if ($user_name eq $row[0]) { # Blah } }
You should also be checking the return values to ensure your statements are being handled properly.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: compare two values in perl
by Anonymous Monk on Dec 10, 2006 at 01:28 UTC |