Hi There, I am working on a query that will dynamiclly use an array. I want to +put the process into a while loop and pass one value at a time to the + where clause. I have tried this a couple of ways with placeholders. + For some reason the process only returns the first index of the arr +ay. As the while loop iterates through the index, I print out the cu +rrent array index and it works. I even pass the array value to the e +mail / attachment and it works. It seems like the prepare statement, + value, and placeholder get saved once. When the test reports are se +nt out...only the first report as data from the first array index. I +s there a way to change this....Can I use the below process and put i +t into a while loop? Does Perl allow this? Thanks in advance.... I + am at home...and I forgot my login...my user name is cocl04...or ema +il me at cory.clay@rentacenter.com or cocl04@yahoo.com...Please help. +..I have been working on this for day...and I came across this postin +g tonight...Thanks...
i.e..... my $i = 0; while (loop...)} # assume that $dbh is ready... my $value = $places[$i]; my $query = <<ENDSQL; SELECT c_mail, c_first, c_last FROM tblClient, tblGroup, tblRegion WHERE tblGroup.g_name = 'motel' AND tblRegion.r_name = ENDSQL my $sth = $dbh->prepare( $query . ' (' . join(',',map{'?'} $value) . +')' ); $sth->execute( $value ); $sth->finish; $dbh->disconnect; $i++; }
In reply to Re^2: SQL queries using dynamic array
by Anonymous Monk
in thread SQL queries using dynamic array
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |