if you don't increase the counter then it will only delete one line then stop the problem is if a line is NULL $line will not work