Get the file and read it into an array, so that each line is an array...like this:
$handle=fopen("blah.txt", "r");
$contents=fread($handle, filesize("blah.txt");
$contentsarray=explode("\n", $contents);
Now you've got an array with each line of your flatfile...but remember that id's will now start with 0!