in reply to Compare items in DB
You're selecting every record from the table that does not match the number you're looking at. That doesn't tell you whether the number is in the table. I'm guessing you want something like this:
my $sth = $dbh->prepare( 'SELECT count(*) FROM num_table WHERE num = ? +' ); foreach my $n ( @num_from_doc ) { $sth->execute( $n ); my ($exists) = $sth->fetchrow_array; my $not = $exists ? '' : ' not'; print "Number $n is$not in the database.\n"; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Compare items in DB
by Anonymous Monk on Mar 05, 2008 at 20:05 UTC | |
by apl (Monsignor) on Mar 05, 2008 at 20:12 UTC | |
|
Re^2: Compare items in DB
by Anonymous Monk on Mar 05, 2008 at 20:18 UTC | |
by kyle (Abbot) on Mar 05, 2008 at 20:51 UTC |