good chemistry is complicated, and a little bit messy -LW |
|
PerlMonks |
Re^4: SQL query using dynamic arrayby cocl04 (Sexton) |
on Nov 18, 2008 at 20:33 UTC ( [id://724377]=note: print w/replies, xml ) | Need Help?? |
What is the following code supposed to do?
Answer: Each time the code runs I select distinct(id) from table. When I fetch the id's and put them into an array, they are all placed into array index '0'. I want to pass individual id's to the sql statement so I add indexes by the above logic where I iterate through by incrementing $i++. Have you tried replacing the query results with hardcoded data? Does the program work then as you want it to?
Answer: Yes. I can set the rd to equal a specific value and it returns the value result. If the array = ('A01','B88','C88',....'nth'), I want to only select * from table where id = 'A01'; pass 'A01' to email, then 'B88'....then 'C88'....'nth'. The while loop iterates through the array and changes the index value. The value changes as $i increments. The problem is the sql code only returns data for the first array index. All of the print statements change. All of the emails and spreadsheet data is changed. but only the first array index is populated in the emailed spreadsheets.
In Section
Seekers of Perl Wisdom
|
|