You will need to get the zip codes' lat and long values.
See, by using trig, you can determine the distance between two points. But a zip code itself does not contain any location information. Its just a code used by the USPS. What you need is something like:
zip, x, y
12345, 1, 4
54321, 3, 6
Here, there is 2 zips and some X and Y data. From this, you can determine the distance between the two points by finding the slope (which is really just distance): (Y2-Y1)/(X2-X1)
Trick is the earth is not flat but sort of round. So this is where the trig comes in, but the concept is the same. The other difference is your X and Y values are latitude and longitude . I have an equation I use, but I don't have it in front of me.
For lat/long coordinates, you have a few choices. If you're looking for dead accurate info, you'll want to contact the USPS. They sell a CD. I don't remember what the cost is. Its not very cheap if I remember correctly. The 2nd option is to hit up the census web site. They keep track of lat/long via a zip code, but the trick is their zip codes don't usually match perfectly with USPS's. They explain in a little more detail the problems and why they don't. If you can live with this, you can extract the data yourself and insert it into you database. It'll require some creativity to get the data, but it can be (and has been) done.