What exactly is the problem you have run into?
Meanwhile, looking over past posts in this thread, I think you could do this:
If you don't mind a *nix centric solution, you can easily grab a whole record for a given $id in the file w/ exec() using commands like grep and awk. This assumes you have the whole record entered on a single line, and starts with the ID:
$cmd = "cat my_text_file.txt | awk /$id/";
$results = array();
exec($cmd, $results, $status);
You'll obviously want to carefully sanitize $id to make sure its an integer and handle the cases where it isn't.