What I am trying to do is create a search by zip code form. When the form is submitted, it will search for members in nearby cities within the given radius.
For example, I submit a form saying find me all members within a 20 mile radius of NYC. That should then display everyone in NYC, Bronx, Manhattan, etc...
Now, the actual radius part of my code is working properly; it is pretty accurate in estimating the distance from point A to point B.
But where I am having a problem is figuring out how to properly loop through the results.
How would I set up the loop, given the pseudo query below?
/* This query will pull data from the table containing zip codes, city / state names, etc */ $query = mysql_query(" SQL Query fetching all cities within 20 miles of current location "); $result = mysql_fetch_assoc($query); /* Now here is where I am lost. This query will need to get all the applicable cities contained in $result above, and then search a table that stores the user information for members who live in any of the cities above. NOTE: Both the tables being queried (the initial zipcode table, and then the following users table) have a column called "city". */ $user = mysql_query(' SELECT all FROM users_table WHERE city = $result ');
Thanks very much for any tips!