Forgive me if i'm wrong, but I think everybody missed a little thing that could help you the next time:
When you do:
@IDnumber=@row1;
inside a loop.
The value of @IDnumber will ALWAYS be the last item of the loop.
So what you need to do, is to ADD an item to @IDnumber, or %IDnumber (using
push array,var; should work fine).
my 2 cents