in reply to Help with a programming problem.
Which as the anonymous monk so rightly implies would show you that $count has not been declared in:
for ($count1 = 0; $count1 < $i2; $count++) [download]
and so the loop never terminates.