Results 1 to 2 of 2
  1. #1
    Join Date
    May 2010

    Unanswered: querying multiple times


    I would like to run a query multiple times in a foreach loop passing different variables from an array into each query. The query works fine on its own, but doesn't in the foreach loop.

    foreach (@array) {

    my $sth2 = $dbh->prepare("SELECT ACCTID FROM data.csv WHERE ACCTID= ?");

    while (my $row2 = $sth2->fetchrow_hashref) {
    push(@array2, $row2->{'ACCTID'});



    Any help would be much appreciated.

  2. #2
    Join Date
    Oct 2002
    Baghdad, Iraq
    The finish call is redundant, but aside from that, you'll have to tell us what error messages you're getting, and show your complete connection string and indicate what OS, DBMS, version of Perl you're using.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts