That method is fine for very small datasets. We found it inefficient when we had 2000+ stores and lots of people searching the database about the same time (more than one per second).
We did some preprocessing and built a sort of index table. For example, let's say that we have zip code 12345 and we already know that there are no stores within 500 miles of that zip code. We make an entry in the table for 12345, 0. Now we don't need to calculate the distance from 12345 -> 200 zip codes.
If the zip code has 1 store within 50 miles and two more that are 51-100 miles away, then we build the table like this:
12345, '55555', '66666 77777'
Now, when someone searches on 12345, we instantly know all the stores that are within 50 miles (55555) and all the stores that are within 100 miles (66666 + 77777). If we want to print actual distances, we can lookup to latlong and calculate as you said but we only have to calculate 3 distances, not 2000+. This technique might be overkill for smaller sites but it is crucial to any site that gets a decent amount of traffic.