In PHP, I have the following code for calculating the distance between two locations:
That's the Haversine formula. You can translate the PHP directly into SQL so you can query the database spatially (the alternative being to pull every record out of the DB and run the data through PHP). MySQL provides all the maths functions that you need.
I did this for a commercial website which provided post/zipcode based distance lookups, so its certainly possible without specific GIS functions.