You have
@row4 = $sth4->fetchrow_array(); both before
and as part of the
while loop conditional. What happens if you take the former away?
--
No matter how great and destructive your problems may seem now, remember, you've probably only seen the tip of them. [1]