You should have some error checking for array boundaries when using split, it will save you a lot of pain.

An alternative method is just to ensure that you have sufficient delimiters. If you change your split to read:
Code:
    $temp = split($row+";;",";")



You will always have at least three elements and will avoid the error. You should still check for missing data though.