Hi Mark,

On 27/09/12 18:10, Mark Haney wrote:
I've been fighting this problem off and on for a couple of months now. It's not something I've spent every moment on, just when I had the time. Now, though, it's necessary I get this working.

What I'm trying to do is to populate 2 drop down lists from the perl code to the html template. I've got one working perfectly, and it's no problem for just one, but the second one is a real PITA. The second one is a separate SQL query (and the query works, btw) using the same handle, etc. My code is below:
...
>     my @rows_shift;
>     while (my $row_shift = $sth->fetchrow_array() )

You're taking the return value in scalar context here, which will give different results to your first query which correctly uses list context (my @array = something_returning_a_list).

Perhaps try this instead:

while(my ($row_shift) = $sth->fetchrow_array()) {

This link might help explain why it's different: http://altreus.blogspot.com/2011/08/lists-and-things-made-of-lists.html

cheers,

Tom
_______________________________________________
templates mailing list
templates@template-toolkit.org
http://mail.template-toolkit.org/mailman/listinfo/templates

Reply via email to