Hi All,

I have a sub routine that needs to check to make sure that a group of tag id
numbers are not already in our database. But I'm not sure this is going to work
the way I think it will or there maybe a better way to do it. Here's the snip:

sub check_tag_num {
my @tagnums = shift();

$sqlquery = qq|SELECT tagid FROM tags WHERE tagnumber = ?|;
$sth = $dbh->prepare($sqlquery) or dbError("Error: $DBI::errstr");

for my $tags (@tagnums) {
$sth->execute($tags);
 my($id) = $sth->fetchrow_array();
$id and error("The Tag Number entered: $tagid is already in our
database","Duplicate Tag Number");       
  }

}

the @tagnums array stores the multiple tagid numbers and I need to loop thru
each one to make sure it's not already in the tags table. Is this the best may
to approach this??

THX's
Mike(mickalo)Blezien
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Thunder Rain Internet Publishing
Providing Internet Solutions that work!
http://www.thunder-rain.com
Tel: 1(225)686-2002
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

Reply via email to