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

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.