I have to say the opposite, its probably the second one, while it has to check ID=$i, it also means it pulls less records from the table.
So, if you have a tiny table, maybe the first, otherwise I think the second.
Of course, theres an article somewhere on the site about checking the execution times of your scritps down to something like 0.000001 of a second of something I think, but in this case, as PORNOST4R and Bruno said, the difference isn't going to be noticable!