Please put your script in "code" tags - it makes it much easier to read.

You need to put in a check to ensure that there are enough elements in the array.

Either:
Code:
WHILE @ERROR = 0

$myarray=Split($x,",")
If UBound($myarray)>=3
; Do the updates
Else
"Not enough elements in '"+$x+"'" ?
EndIf
Loop