On Friday 04 November 2005 12:12 pm, jean wrote: [snip] > > foreach (my @result = $sth->fetchrow_array) { > $sku[$i]=$result[0]; > $qty[$i]=$result[1]; > $t_qty[$i]=0; > if ($i < 2) { > $t_qty[$i]=$qty[$i]; > } > else { > if ($sku[$i]==$sku[$i-1]){ > $t_qty[$i]= $t_qty[($i-1)] + $qty[$i]; > if($i==$n){ >******* print "$sku[$i]",', totaalaantal is ', >"$t_qty[$i]\n"; > } > } > else { > $t_qty[$i]=$qty[$i]; > if($i==$n){ > print "$sku[$i]",', totaalaantal is ', > "$t_qty[$i]\n"; > } > else { >******* print "$sku[$i-1]",', totaalaantal is ', >"$t_qty[$i-1]\n"; > } > } > } > } > } > [snip]
Looks like you're printing while you're still on the record and then you're printing it again once you've moved to the next. -- Gary Stainburn This email does not contain private or confidential material as it may be snooped on by interested government parties for unknown and undisclosed purposes - Regulation of Investigatory Powers Act, 2000 -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>