in reply to Displaying Images using Perl
while (my $item_id = $sth->fetchrow_array ())
fetchrow_array returns an array, which you are assigning to a scalar. This forces the array into scalar context, which results in the number of items in the array. Which is one, because you did a single column query.
The easiest way to fix it would be to do:
while (my ($item_id) = $sth->fetchrow_array ())
Now you're assigning an array to a list, which sequentially fills the elements of the list with the elements of the array... As it's only a single-item list and a single-item array, you get the actual column content... Which is what you wanted all along...
Happy Coding!
Update: Nope. I'm wrong... Thankfully I wasn't the only one... :) Sorry...
|
|---|